plim8481
plim8481

Reputation: 53

Play Setting maxInitialLineLength not working

I am working on a Scala API that may require occasional GET requests where the URL is longer than 4kb. I see that we need a setting play.server.netty.maxInitialLineLength set, and I tried setting this to 8192 (8 kb), but still fails:

org.jboss.netty.handler.codec.frame.TooLongFrameException: An HTTP line is larger than 4096 bytes.
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readLine(HttpMessageDecoder.java:670) ~[netty-3.10.5.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:184) ~[netty-3.10.5.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:102) ~[netty-3.10.5.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500) ~[netty-3.10.5.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:485) ~[netty-3.10.5.Final.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) ~[netty-3.10.5.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.10.5.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) [netty-3.10.5.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty-3.10.5.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty-3.10.5.Final.jar:na]

We are running play 2.4.8 right now. Is there something I am missing?

Upvotes: 3

Views: 1592

Answers (1)

Uwe
Uwe

Reputation: 436

I assume you're testing this locally and starting Play with the run command.

When doing this, the HTTP server settings in application.conf cannot be applied because the HTTP server is being started before the application.conf is being read (see also official Play documentation).

You have three options to get this working:

  1. start the app in production mode, or
  2. provide the configuration as a JVM parameter instead (run -Dplay.server.netty.maxInitialLineLength=8192), or
  3. modify your build.sbt (devSettings := Map("play.server.netty.maxInitialLineLength" -> "8192")).

Upvotes: 2

Related Questions