1

I am trying to make a POST request to an endpoint served using jetty server. The request errors out saying 413 Request entity too large. But the content-length is only 70KB which I see is way below the default limit of 200KB.

Error image

I have tried serving via ngnix server and add client_max_body_size to desired level but that didn't work. I have set the setMaxFormContentSize of WebContext and that didn't help either. I have followed https://wiki.eclipse.org/Jetty/Howto/Configure_Form_Size and that didn't helped me either.

Does anyone have any solution to offer?

Mani
  • 1,364
  • 14
  • 33

1 Answers1

0

wiki.eclipse.org is OLD and is only for Jetty 7 and Jetty 8 (long ago EOL/End of Life). The giant red box at the top of the page that you linked it even tell you this, and gives you a link to the up to date documentation.

If you see a "413 Request entity too large" from Jetty, then it refers the the Request URI and Request Headers.

Note: some 3rd party libraries outside of Jetty's control can also use HttpServletResponse.sendError(413) which would result in the same response status message as you reported.

Judging by your screenshot, which does not include all of the details, (it's really better to copy/paste the text when making questions on stackoverflow, screenshots often hide details that are critical in getting a direct answer), your Cookie header is massive and is causing the 413 error by pushing the Request Headers over 8k in size.

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
  • What content do you want me to copy and paste @Joakim Erdfelt? 8KB shouldn't be heavy given that Jetty sets the default at 200KB. To give more info, it isnt the cookie problem. The request payload is heavy. If i downsize it, then there is no problem at all. – Mani Nov 01 '18 at 02:01
  • Jetty sets the request headers and response headers limits to 8k, not 200k. The error you are getting is very likely within the headers, not the body. – Joakim Erdfelt Nov 01 '18 at 10:21
  • In your screenshot, there's a link "view source" next to "Request Headers", that will give you the raw headers you sent. Once you see it that way, it will (hopefully) become very obvious what the problem is. – Joakim Erdfelt Nov 01 '18 at 10:22