Blocking a CORS request [SYMFONY]

I work on Ionic and when I launch a request on my API (Symfony 5), both are local, I have this error:

enter image description here

On the Symfony side, I modified the .env by putting:



And in nelmio_cors.yaml:

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

Despite this, I still get the same error.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *