nelmio / NelmioCorsBundle

Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony application
https://symfony.com/bundles/NelmioCorsBundle/
MIT License
1.89k stars 108 forks source link

Malformed shell syntax for CORS_ALLOW_ORIGIN recipe defaults #149

Closed fyrye closed 1 year ago

fyrye commented 4 years ago

The default recipe installs with CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$

Which errors when loaded from shell.

source ./.env

Result

./.env: line 48: syntax error near unexpected token `('
./.env: line 48: `CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'

To resolve the issue, wrap the pattern in double quotes, which will be parsed out by symfony/dotenv and be properly configured in shell

CORS_ALLOW_ORIGIN="^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$"
yannoff commented 3 years ago

@fyrye \o/ Should be fixed by https://github.com/symfony/recipes/pull/849