Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST Request returns 400 with wrong Headers #189

Open
tillkwl opened this issue May 31, 2023 · 2 comments
Open

POST Request returns 400 with wrong Headers #189

tillkwl opened this issue May 31, 2023 · 2 comments

Comments

@tillkwl
Copy link

tillkwl commented May 31, 2023

I got a basic nelmio_cors.yaml configuration, when I perform a GET Request from my Nextjs Frontend, everything works perfectly fine, when I perform a POST Request instead, it returns a 400 with the headers you can see below, I have a basic POST Controller for my route where Im not using any sessions so the return doesnt make any sense to me, especially because the get request works.
Ive tried many different configurations for nelmio which didnt change anything whatsoever.
I also tried using Firefox, Chrome and Edge.
Using Postman it works, so its definitely a Cors error.
grafik
grafik
grafik
grafik
grafik

@MaratKagyu
Copy link

Did you find a solution for this?

@MaratKagyu
Copy link

I found a possible solution. Make sure all the headers in OPTIONS request are mentioned in the allow_headers section. In my case the browser was also sending 'X-Requested-With' header. After I added it to allow_headers, it finally started working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants