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

Symfony 5: 502 Bad Gateway #167

Closed SiMoSiMo2 closed 1 year ago

SiMoSiMo2 commented 3 years ago

I have some (fake) routes, like:

#[Route('/prova', name: 'prova', methods: ['GET'])]
public function prova(): Response
{
    return $this->json('SUCCESS', Response::HTTP_OK);
}
#[Route('/prova-post', name: 'prova-post', methods: ['POST'])]
public function prova(): Response
{
    return $this->json('SUCCESS', Response::HTTP_OK);
}
#[Route('/contacts/{id}', name: 'get-contact', methods: ['GET'])]
public function getContact(Contact $contact): Response
{
    return $this->json('SUCCESS', Response::HTTP_OK);
}

All these routes work correctly before installing this bundle. After installing the bundle only get-contact endpoint works. The others return: 502 Bad Gateway

I've tried with the default nelmio_cors.yaml and also with the one provided by the readme file. Nothing has changed.

Any idea?

Symfony5.3, nginx 1.21, php8

fd6130 commented 3 years ago

Hmmm is it because of the nginx config? Try with apache instead? Or you might need to do something about the config, i guess?