3

I am trying to migrate a Play 2.5 version to 2.6.2. I keep getting the URI-length exceeds error. Anyone knows how to override this?

I tried below Akka setting but still no luck.

play.server.akka{
http.server.parsing.max-uri-length = infinite
http.client.parsing.max-uri-length = infinite      
http.host-connection-pool.client.parsing.max-uri-length = infinite      
http.max-uri-length = infinite
max-uri-length = infinite
}
sarath
  • 103
  • 3
  • 8

4 Answers4

5

Simply add

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

to your application.conf. The prefix play.server is only used for a small subset of convenience features for Akka-HTTP integration into the Playframework, e.g. play.server.akka.requestTimeout. Those are documented in the Configuring the Akka HTTP server backend documentation.

mana
  • 6,347
  • 6
  • 50
  • 70
  • Maybe add it to your `sbtopts` as `-J-Dakka.http.parsing.max-uri-length=16k` – mana Oct 13 '17 at 09:57
  • Thank you, the trick is indeed to put it on command line instead of configuration file. I am guessing that Akka Http is not getting configurations from the play configuration files, at least not in the development mode (I haven't tried it in production mode yet). So this worked for me: `./activator -Dakka.http.parsing.max-uri-length=16k "run"` – Leonya Nov 21 '17 at 16:30
  • 2
    After reading the in-depth discussion on https://github.com/playframework/playframework/issues/7617 I found that another solution in development is to add this line to build.sbt: `PlayKeys.devSettings := Seq("play.akka.dev-mode.akka.http.parsing.max-uri-length" -> "20480")` – Leonya Nov 21 '17 at 17:15
3

I was getting error due to header length exceeding default 8 KB(8192). Added the following to build.sbt and it worked for me :D

javaOptions += "-Dakka.http.parsing.max-header-value-length=16k"

You can try similar for uri length if other options don't work

Turtle
  • 325
  • 1
  • 3
  • 11
1

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

Here is a snippet (confirmed working with play 2.8) 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

If anyone getting this type of error in chrome browser when trying to access a site or login. [HTTP header value exceeds the configured limit of 8192 characters] , Go to chrome

settings -> Security and Privacy -> Site Settings , View Permission and data stored across sites

Search for the specific website and on that site do Clear all data.

mykey
  • 1,943
  • 19
  • 13