1

Any idea of why the next code returns the referer in development and production mode in my local computer and in development mode in the server, but not in production mode in the server?

$this->getRequest()->headers->get('referer');

Firefox is sending the referer, so I don't understand why I am getting no value.

Manolo
  • 24,020
  • 20
  • 85
  • 130
  • See the comments of the accepted answer: http://stackoverflow.com/questions/9057745/how-to-go-back-to-referer-after-login-failure – Jovan Perovic May 28 '14 at 18:39
  • @jperovic - Do you mean *$request->headers->get('referer'); sometimes returns null (I've reproduced in Firefox). This solution is not reliable, a fallback or another solution is necessary.*? If it's true, the only way I can imagine is to store the current route in session, since I've tested also with Chrome and Safari and referer keeps null. – Manolo May 28 '14 at 18:52
  • Yeah, pretty much it. Session is perfect for that ;) – Jovan Perovic May 28 '14 at 20:15

1 Answers1

0

You should be able to grab it from the server parameter bag.

$request->server->get('HTTP_REFERER')
Nate
  • 511
  • 4
  • 14