Reputation: 2505
We are trying to send GET and POST requests with a length greater than 4096 bytes to our REST API implemented with Playframework 2.2.6.
After a long google research we tried nearly everything and the solution seems to be passing the following two arguments when starting our server via play. We receive no error message about wrong parameters but when we send a large request to the api we still receive the error
TooLongFrameException: An HTTP line is larger than 4096 Bytes
We are running the server by the following command
<PathToPlay>\play-2.2.6\play.bat -org.jboss.netty.maxHeaderSize:102400 -org.jboss.netty.maxInitialLineLength:102400 run
Upvotes: 1
Views: 954
Reputation: 1033
First of all your path to start your application seems off. When you create a new play application a play.bat
or activator.bat
file is automatically created in your project root folder. So no need to call a specific play installation runtime outside your project folder.
The parameters for setting the max body and header length can be found in the play documentation.
http.netty.maxInitialLineLength
- The maximum length for the initial line of an HTTP request, defaults to 4096
http.netty.maxHeaderSize
- The maximum size for the entire HTTP header, defaults to 8192
To start your application in development mode call
/path/to/project/play run -Dhttp.netty.maxInitialLineLength=102400 -Dhttp.netty.maxHeaderSize=102400
If you've used Activator to create your project replace play
with activator
.
After you've published your application for production with play dist
you can set the parameters by calling
/path/to/publishedApp/bin/<nameOfApp> -Dhttp.netty.maxInitialLineLength=102400 -Dhttp.netty.maxHeaderSize=102400
Upvotes: 1