0

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.

Fiser
  • 25
  • 8
  • Did you try something like that: ` $response = new RedirectResponse($url, 302, $headers = array( 'Authorization' => 'JWT ' . $this->jwt )); return $response; ` – Romain Norberg Feb 14 '18 at 19:06
  • Yes and don't found, the headers never sends in redirection – Fiser Feb 15 '18 at 03:47

2 Answers2

1

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

Vacilando
  • 2,819
  • 2
  • 30
  • 27
0

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

Fiser
  • 25
  • 8