0

I had this configuration , i use play 2.6 and i cant use Netty and POST

 play.server.akka{
    http.server.parsing.max-uri-length = 16k
    http.client.parsing.max-uri-length = 16k      
    http.host-connection-pool.client.parsing.max-uri-length = 16k      
    http.max-uri-length = 16k
    max-uri-length = 16k
}

akka.http {
  parsing {
    max-uri-length = 16k
  }
}

But throw this exception akka.actor.ActorSystemImpl(play-dev-mode)] Illegal request, responding with status '414 Request-URI Too Long': URI length exceeds the configured limit of 2048 characters

drcimux
  • 45
  • 1
  • 7

2 Answers2

1

From my original Post here: https://stackoverflow.com/a/63390208/1029251

This took me way to long to figure out. It is somehow NOT to be found in the documentation.

Here is a snippet to put in your application.conf which is also configurable via an environment variable and works for BOTH dev and prod mode:

# Dev Mode
play.akka.dev-mode.akka.http.parsing.max-uri-length = 16384
play.akka.dev-mode.akka.http.parsing.max-uri-length = ${?PLAY_MAX_URI_LENGTH}

# Prod Mode
akka.http.parsing.max-uri-length = 16384
akka.http.parsing.max-uri-length = ${?PLAY_MAX_URI_LENGTH}

You can then edit the config or with an already deployed application just set PLAY_MAX_URI_LENGTH and it is dynamically configurable without the need to modify commandline arguments.

env PLAY_MAX_URI_LENGTH=16384 sbt run
Julian Pieles
  • 3,880
  • 2
  • 23
  • 33
0

Since you're running in dev mode, add the akka.http.parsing.max-uri-length=16k configuration setting to the command line:

-Dakka.http.parsing.max-uri-length=16k
Jeffrey Chung
  • 19,319
  • 8
  • 34
  • 54
  • In dev mode i had PlayKeys.devSettings := Seq("play.akka.dev-mode.akka.http.parsing.max-uri-length" -> "4096") in sbt and it works . But how i can do in prod (not in dev mode ) ? – drcimux Nov 22 '17 at 10:53