POST Request returns wrong Headers using Nelmio Cors in Symfony
I got a basic nelmio cors 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.
#[Route('/applicants', name: 'applicant_create', methods:['post'] )]
public function create(ManagerRegistry $doctrine, Request $request): JsonResponse
{
#[Route('/api', name: 'api_')]
class ApplicantApiController extends AbstractController
{
#[Route('/applicants', name: 'get_all_applicants', methods: ['get'])]
public function index(ManagerRegistry $doctrine): JsonResponse
{
nelmio_cors:
defaults:
allow_credentials: false
allow_origin: []
allow_headers: []
allow_methods: []
expose_headers: []
max_age: 0
hosts: []
origin_regex: false
forced_allow_origin_value: ~
skip_same_as_origin: true
paths:
'^/api/':
allow_origin: ['*']
allow_headers: ['X-Custom-Auth']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE', 'OPTIONS']
max_age: 3600
'^/':
origin_regex: true
allow_origin: ['^http://localhost:[0-9]+']
allow_headers: ['X-Custom-Auth']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE', 'OPTIONS']
max_age: 3600
hosts: ['^api\.']