URI encoded slahes in path parameters lead to action not found
See original GitHub issueLagom Version (1.2.x / 1.3.x / etc)
1.3.5 Dev Mode
API (Scala / Java / Neither / Both)
Java
Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
4.4.0-77-generic #98-Ubuntu SMP Wed Apr 26 08:34:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
JDK
java version “1.8.0_131” Java™ SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot™ 64-Bit Server VM (build 25.131-b11, mixed mode)
Expected Behavior
When sending requests to the hello endpoint of the from archetype generated project, defined as pathCall("/api/hello/:id", this::hello)
, and the id parameter contains URI encoded slashes (http://localhost:9000/api/hello/Alice%2FThat%2Fis%2Fmy%2Fname
), it should invoke the service method with the id provided.
Actual Behavior
A 404 - Action not found page is rendered. Stating that all routes have been tried but none is matching.
<h1>Action Not Found</h1>
<p id="detail">
For request 'GET /api/hello/Alice/That/is/my/name'
</p>
...
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
urlencoded Forward slash is breaking URL - Stack Overflow
I am using urlencode() while preparing the search URL and urldecode() while reading the search URL. Problem. Only the forward slash character is ......
Read more >Passing a parameter with slashes to the REST call
I need to pass a parameter string that contains slashes to a REST call. I tried URL encoding, or making URL map to...
Read more >EXPLOITING URL PARSERS: THE GOOD, BAD, AND ...
The confusion in URL parsing can cause unexpected behavior in the software ... scheme confusion, slashes confusion, backslash confusion, URL encoded.
Read more >Scala Routing - 2.8.x - Play Framework
Unlike other pattern types, path segments are automatically URI-decoded in the route, before being passed to your controller, and encoded in the reverse...
Read more >encodeURI() - JavaScript - MDN Web Docs
The encodeURI() function encodes a URI by replacing each instance of ... do not encode any valid Unicode character, they cause encodeURI() ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just did a bit more testing:
curl http://localhost:9000/api/hello/Alice%2FThat%2Fis%2Fmy%2Fname
) I get the 404 as reportedcurl http://localhost:57797/api/hello/Alice%2FThat%2Fis%2Fmy%2Fname
) I get the expected result:Hello, Alice/That/is/my/name!
So I’m going to call this fixed by #894. We don’t plan to continue fixing problems with the existing, netty-based service gateway, and the akka-http one will be the default in Lagom 1.4.
Until then, you can enable it in 1.3.7+ by:
lagomServiceGatewayImpl in ThisBuild := "akka-http"
to yourbuild.sbt
or<serviceGatewayImpl>akka-http</serviceGatewayImpl>
1.3.7 has not been released yet, but there is a 1.3.7-RC1 pre-release build available in Maven Central that includes the new gateway, so if you need it urgently, you can use that.
OK thanks for confirming that. That behaviour is what we’re getting when using a standard Play router. Lagom is probably using a different technique for routing.