mezzio/mezzio-cors

Provided Origin "capacitor://localhost" is an invalid

lorenzhh opened this issue · 1 comments

Bug Report

Mezzio\Cors\Exception\InvalidOriginValueException raised in file /vendor/mezzio/mezzio-cors/src/Exception/InvalidOriginValueException.php in line 21 with message: Provided Origin "capacitor://localhost" is invalid.

Q A
Version(s) 1.3.0

Summary

While running IOS Simulator in XCode, An Exception is raised from the mezzio-cors package.

Current behavior

The exception is raised on every request comes from the cliend side (XCode Simulator). mezzio-cors claims that capacitor://localhost is invalid origin

How to reproduce

in pipeline.php

use Mezzio\Cors\Middleware\CorsMiddleware;

$app->pipe(CorsMiddleware::class);

Expected behavior

Should be able to add the capacitor://localhost to the allowed origins

return [
    ConfigurationInterface::CONFIGURATION_IDENTIFIER => [
        'allowed_origins' => ['capacitor://localhost', 'http://localhost'],
        'allowed_headers' => ['Content-Type', ' Access-Control-Allow-Headers', 'Authorization'],
        'allowed_max_age' => '3600',
        'credentials_allowed' => true,
        'exposed_headers' => []
    ],

PS. This is my first bug report ;)

The limitation does not come from this component.
It comes from the PSR-7 implementation and thus needs to be addressed there.

Closing this as duplicate of #37.