1

I am making a GET request and I am appending 40 strings to a query parameter. And each string is 100 chars long.

Why would I be Request Entity Too Large error even though there is no file involved? Also, if I understood the limitations of a query params correctly, then there is no limit to it unless browser has placed a limitation. And I am making a request without a browser anyway (via Tests).

I have tried max request size to 200 MB and max file upload size to 200 MB. I am sure file has nothing to do with it, but just to test it I put that limit for a file upload.

When I send in 39 strings where each string is still 100 chars long, the request pass without problems. What else I can do?

Faraz
  • 6,025
  • 5
  • 31
  • 88
  • Maybe related to [What is the maximum length of a URL in different browsers?](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers) – Turing85 Apr 26 '21 at 22:10
  • Where are you sending the request _to_? While the standard doesn't stipulate a maximum length for a URL, a server may refuse to process a URL with too many query params and return a 413 deliberately. The fact that you're getting 413 (Request Entity Too Large) and not 414 (Request URI Too Large) suggests that it's a server-side thing. – Green Cloak Guy Apr 26 '21 at 22:10
  • @Turing85 I am not sending the request via a browser. I am sending it via tests written in Java/Micronaut. – Faraz Apr 26 '21 at 22:11
  • 2
    @Faraz yes I know, but server implementations may have limits as well – Turing85 Apr 26 '21 at 22:12
  • @GreenCloakGuy Backend written in Java/Micronaut. – Faraz Apr 26 '21 at 22:12
  • How can I resolve this then? I have already tried `max request size to 200 MB and max file upload size to 200 MB`. And these properties are set because I can read Micronaut's configurations after app is up. – Faraz Apr 26 '21 at 22:14
  • @Turing85 and even when I take into consideration the URL that you posted, when I send in 39 strings where each string is still 100 chars long, the request pass without problems. So if we do the match, that's already 3900 chars without even counting the context path etc. – Faraz Apr 26 '21 at 22:16
  • When I am honest, 39*100 chars query strings sounds like a bad design choice in any way :/ – maio290 Apr 26 '21 at 22:16
  • @maio290 yes but this is just a test process – Faraz Apr 26 '21 at 22:17
  • @maio290 and even if I send them in a body, wouldn't I still get the same error? I will change the design. First I need to figure out how to get rid of this error. – Faraz Apr 26 '21 at 22:18
  • @Faraz If you can pin point the problem that exactly, then I would guess that this is a limitation of micronaut. Possible resolutions that come to my mind: a) dig in the micronaut code, see where things go wrong, fix it - b) open a ticket against micronaut - c) don't use that many query parameters – Turing85 Apr 26 '21 at 22:19

1 Answers1

3

micronaut.server.netty.max-initial-line-length is the answer. If someone stumbles upon it, in case.

Faraz
  • 6,025
  • 5
  • 31
  • 88