5

In play Framework, how can I get the URL the user came from in a controller?

I've tried request.url, but that isn't working.

HoldOffHunger
  • 10,963
  • 6
  • 53
  • 100
Kory
  • 357
  • 1
  • 3
  • 22

1 Answers1

17

Previous url will come with the http headers under the referer key. In JAVA you can get it using:

String refererUrl = request().getHeader("referer");

and if you doing it in Scala:

val refererUrl = request.headers("referer")
Vinicius Miana
  • 2,007
  • 14
  • 25
biesior
  • 54,554
  • 10
  • 118
  • 177