Play 2.6, URI length exceeds the configured limit of 2048 characters

后端 未结 3 450
误落风尘
误落风尘 2021-01-06 16:56

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 s

3条回答
  •  旧时难觅i
    2021-01-06 17:28

    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
    

提交回复
热议问题