Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "Error parsing HTTP request header" when POSTing a JSON string?

I am trying to send a POST request from browser to my server(local host). My request URL is :

 http://localhost:8080/myPath/myServlet?requestData={  .......//Json String......};

requestData is a json String (I am using GSON for the purpose.) Everything is working fine until the data in the json string exceeds a particular limit. Say, I am sending array of objects in the json string. If the number of objects in the list exceed 67 then I get following error :

 AM org.apache.coyote.http11.AbstractHttp11Processor process
 INFO: Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.

Why is this so? I am totally confused. Why does this happen and what needs to be done to fix this? I want to understand the reason behind this, for I don't understand that after particular number of objects it suddenly stops working and I get this error in my console.

like image 294
user3686864 Avatar asked Oct 22 '14 09:10

user3686864


2 Answers

It seems that you are using POST incorrectly. Although you are using POST you are sending JSON as a request parameter that is the GET style. When using POST you should send content as a request body. In this case no reasonable size limitation exist.

like image 187
AlexR Avatar answered Sep 18 '22 05:09

AlexR


I had a similar issue, I was sending a POST request (using RESTClient plugin for Firefox) with data in the request body and was receiving the same message.

In my case this happened because I was trying to use HTTPS protocol in a local tomcat instance where HTTPS was not configured.

like image 36
nkatsar Avatar answered Sep 22 '22 05:09

nkatsar