Search code examples
javaapache-httpclient-4.xapache-httpcomponents

Request Entity too large error in java apache HttpClient


While searching the solution for this issue, I read somewhere that max size of get request is 8Kb. However when I am trying to execute get request of content length of only 248 bytes and total URL length of only 282 characters through Apache HttpClient execute method, Apache HttpClient is giving me error: org.apache.http.HttpException: HTTP/1.1 413 Request Entity Too Large.

However the same get request (the same URL) gives expected response in browser (and NOT "413 Request Entity Too Large").

Apache HttpClient execute method is working fine for some other get request which is slightly smaller in length and has lesser no. of query params.

I also tried sending the Post request but still got the same error.

Please help me resolve this issue. Any help will be appreciated The other seemingly similar questions didn't solve my problem.


Solution

  • Sorry the issue was not on client side. But the internal API that I am using was sending incorrect 413 response code instead of (almost) correct response code 507.