NelmioCorsBundle: Symfony 5, all urls are ignored

Hello,

I just installed the bundle with Symfony 5, there were no problems during the installation. The default configuration was ok, until i added a query parameter to the request, and everthing is now ignored.

Here the form of the url i tried to use: 'http://localhost/api/users?page=1

Im using this configuration (the default one):

nelmio_cors:
    defaults:
        origin_regex: true
        allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
        allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
        allow_headers: ['Content-Type', 'Authorization']
        expose_headers: ['Link']
        max_age: 3600
    paths:
        '^/': null

Here is the environment variable i’m using in the .env file:

CORS_ALLOW_ORIGIN=^.*$

I tried a lot of different pattern match for the regex, i tried to remove the regex and hardcode the url, but none of them are working and i can’t find any solution.

It’s either that the plugin isn’t supported by Symfony 5 yet, or that there is something terribly wrong.

Of course it’s highly probably that my configuration is wrong, but since i’m using everthing by default and that my regex is quite largely open, i can’t get it.

I would greatly appreciate if you could help me on this one.

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 12
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Any updates on this one?

People, let’s learn what the emojis mean please, especially the thumbs-up one. “Same here” is not constructive help.

I’ve got the same problem on an application that I upgraded from Symfony 4.3 to 5.0. It worked while it was on Symfony 4.3.