Hi guys,
lagom framework is throwing an URI exception for /image.gif?sid={a}
({ or } should be encoded) even when I setup the akka uri parsing to relaxed:
akka {
http {
server {
parsing {
raw-request-uri-header = on
uri-parsing-mode = relaxed
}
}
}
}
I suspect that lagom does not respect this akka settings and after akka lets the uri into the system, it is processed again with java.net.URI which throws the exception.
2019-11-28 09:32:17,121 ERROR play.http.DefaultHttpErrorHandler -
! @7e26d4hci - Internal server error, for (GET) [/image.gif?sid={a}] ->
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[IllegalArgumentException: Illegal character in query at index xx: /image.gif?sid={a}]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:338)
at play.api.http.HttpErrorHandlerExceptions.throwableToUsefulException(HttpErrorHandler.scala)
at play.http.DefaultHttpErrorHandler.throwableToUsefulException(DefaultHttpErrorHandler.java:227)
at play.http.DefaultHttpErrorHandler.onServerError(DefaultHttpErrorHandler.java:182)
at com.lucidhq.tracker.impl.http.ErrorHandler.onServerError(ErrorHandler.java:69)
at play.core.j.JavaHttpErrorHandlerAdapter.onServerError(JavaHttpErrorHandlerAdapter.scala:33)
at play.core.server.Server$$anonfun$handleErrors$1$1.applyOrElse(Server.scala:104)
at play.core.server.Server$$anonfun$handleErrors$1$1.applyOrElse(Server.scala:100)
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:37)
at play.core.server.Server$.getHandlerFor(Server.scala:124)
at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:324)
at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:194)
at akka.stream.impl.fusing.MapAsync$$anon$30.onPush(Ops.scala:1261)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:526)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:410)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:610)
at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:489)
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:585)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:753)
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:768)
at akka.actor.Actor.aroundReceive(Actor.scala:532)
at akka.actor.Actor.aroundReceive$(Actor.scala:530)
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:675)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:570)
at akka.actor.ActorCell.invoke(ActorCell.scala:540)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:269)
at akka.dispatch.Mailbox.run(Mailbox.scala:230)
at akka.dispatch.Mailbox.exec(Mailbox.scala:242)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Caused by: java.lang.IllegalArgumentException: Illegal character in query at index xx: /image.gif?sid={a}
at java.base/java.net.URI.create(URI.java:906)
at com.lightbend.lagom.internal.server.ServiceRouter.$anonfun$routes$2(ServiceRouter.scala:102)
at scala.PartialFunction$Unlifted.applyOrElse(PartialFunction.scala:324)
at scala.collection.IterableOnceOps.collectFirst(IterableOnce.scala:1087)
at scala.collection.IterableOnceOps.collectFirst$(IterableOnce.scala:1079)
at scala.collection.AbstractIterable.collectFirst(Iterable.scala:904)
at com.lightbend.lagom.internal.server.ServiceRouter.$anonfun$routes$1(ServiceRouter.scala:97)
at scala.PartialFunction$Unlifted.applyOrElse(PartialFunction.scala:324)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:246)
at scala.PartialFunction$Lifted.apply(PartialFunction.scala:315)
at scala.PartialFunction$Lifted.apply(PartialFunction.scala:311)
at play.api.routing.Router.handlerFor(Router.scala:53)
at play.api.routing.Router.handlerFor$(Router.scala:53)
at com.lightbend.lagom.internal.javadsl.server.JavadslServicesRouter.handlerFor(JavadslServerBuilder.scala:145)
at play.api.http.DefaultHttpRequestHandler.routeRequest(HttpRequestHandler.scala:270)
at play.api.http.JavaCompatibleHttpRequestHandler.routeRequest(HttpRequestHandler.scala:347)
at play.api.http.DefaultHttpRequestHandler.routeWithFallback$1(HttpRequestHandler.scala:168)
at play.api.http.DefaultHttpRequestHandler.handlerForRequest(HttpRequestHandler.scala:218)
at play.core.server.Server$.getHandlerFor(Server.scala:121)
... 23 common frames omitted
Caused by: java.net.URISyntaxException: Illegal character in query at index xx: image.gif?sid={a}
at java.base/java.net.URI$Parser.fail(URI.java:2936)
at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3195)
at java.base/java.net.URI$Parser.parse(URI.java:3148)
at java.base/java.net.URI.<init>(URI.java:623)
at java.base/java.net.URI.create(URI.java:904)
... 41 common frames omitted
Is there any way around this? Do you think the behaviour is correct?