Fiser
Fiser

Reputation: 43

Symfony RedirectResponse delete my custom headers headers

I am doing a symfony application an I have this return in a route.

$response = new RedirectResponse($url, 302);

$response->headers->set(
    'Authorization', 'JWT ' . $this->jwt );

return $response;

The problem is that when I launch this code at the browser I don't have the Authorization header in the response.

If I launch with curl in the same route found, I recibe the header. I don't now the reason.

Upvotes: 0

Views: 1633

Answers (2)

Vacilando
Vacilando

Reputation: 3047

Custom headers cannot be sent with a redirect, see Redirect to page and send custom HTTP headers for full details.

Upvotes: 1

Fiser
Fiser

Reputation: 43

I don't solved the problem but I use the cookies for send the jwt

Upvotes: 0

Related Questions