scala - AbsoluteURI support in Play Framework 2.1 -
as stated here: http://www.w3.org/protocols/rfc2616/rfc2616-sec5.html
to allow transition absoluteuris in requests in future versions of http, http/1.1 servers must accept absoluteuri form in requests, though http/1.1 clients generate them in requests proxies.
i have client sends post-requests play-2.1.1 server. sends way:
post http://172.16.1.227:9000/a8%3af9%3a4b%3a20%3a89%3a40/1089820966/ http/1.1 content-length: 473 content-type: application/json date: thu, 25 apr 2013 15:44:43 gmt host: 172.16.1.227:9000 user-agent: my-client ...some data...
all requests rejected "action not found" error. same request send using curl fine , difference between them curl send relative uri:
post /a8%3af9%3a4b%3a20%3a89%3a40/1089820966/ http/1.1 accept: */* content-length: 593 content-type: application/json host: 172.16.1.227:9000 user-agent: curl/7.30.0
i created following simple workaround in global.scala:
override def onrouterequest(request: requestheader): option[handler] = { if (request.path.startswith("http://")) { super.onrouterequest(request.copy( path = request.path.replace("http://"+request.host, "") )) } else super.onrouterequest(request) }
and workaround requests client handled correctly.
so, there more straightforward way in play framework or thats way?
thanks @nraychaudhuri play 2.2 supports absoluteuri
-style request headers.
here's issue , pull request: https://github.com/playframework/playframework/pull/1060