HTTP element QUERY_STRING is longer than the (1024 * 10) allowed length (was 13692)


I am getting below error while passing huge query string in AJAX.I am using Puma Server.How to fix this issue in puma server?

HTTP parse error, malformed request ():<Puma::HttpParserError: HTTP element 
 QUERY_STRING is longer than the (1024 * 10) allowed length (was 13692)>

Is there any other app server available for Concurrency and support long URI?



It’s not a good idea to send that long query with GET request. Even if you are able to change puma settings to allow that you still shouldn’t do it. Every browser and server (nginx etc) has its own limit and you will not pass it. POST request don’t have this limitation so you should use it.


Thanks.I tried post also.I am getting same error.Routes also do I need to make change post instead of get.


If you get exactly the same error with POST request then you still trying to pass data through QUERY string rather than really send it as POST payload. Could you please paste code of this AJAX you send?


Yes sure.Below the code I am using.

if (Device1) {
  parameter_name = $('#parameters_object').val();
  var getParams=parameter_name.split(',');
  if (paramLen > 200){


  //m is a selected mac address length count
  for (var i = 0; i < m; i++) {

    (function () {

      var macAdd = values[i];
          method: "POST",
          url: "get_object",
          dataType: "json",
          data: {
            parameter: getParams,
            mac: macAdd,
            protocol: protocol,
            serialnumber: serialnumber,

          success: function (result) {


        statusCode: {
        404: function () {
          console.log("Call failed");




Hm, it looks ok. Please, have a look on that problematic request in chrome (or other browser you use) dev tool. You should see exactly how browser send request (chosen method, request url, payload etc). Maybe that request is not send by the code you pasted here. Anyway, error clearly indicated that the problem is that query string (it’s the part after ‘?’ in url) is too long.


Yes.I will pass around 300 parameters with comma separated.that is the reason I am getting this error.But Webrix server it is working fine.Since Webrix is slow and not supporting Concurrency,we have moved to puma.


My answer remains. Move those query string parameters to data parameters of your POST request. Even if did work with webrick it possibly could not work with some browsers. Please, read


Ok Thanks.How to move from query string to data parameters? If I changed as form data instead of json,will it work?


It should work as json as well as form data. Your code looks good already. TBH I don’t know what the problem is. Maybe you could prepare working example of your problem? Try to isolate entire code (html, js + simple app running on puma) and create github repo which I can clone and try to run? Without having reproducible example I can’t help.


Thanks for your time.I have tried with POST request.I am getting below error.

ActionDispatch::ParamsParser::ParseError (822: unexpected token at params).

Do i need make changes in rails controller?


Oh, now I noticed you didn’t specify contentType header in your request (dataType sets expected response from browser, it has nothing to do with how you send data). Also you have to convert your data (javascript object) to json format.

  url: "/my_url"
  method: "POST",
  contentType: "application/json",
  data: JSON.stringify({ foo: "bar" })

You can also try as a normal form data (x-www-form-urlencoded content type)

  url: "/my_url"
  method: "POST",
  data: "foo=bar"


Thanks lot.It is working now.


I am able to post request with insert huge data into db.But I am getting below error if i am trying to POST in webservice call.

I am passing parameters as below in rails

@macAddress= params[‘mac’]


My Controller code below

def get_object
  result = ''

    if params['protocol']['pa'] == "true"
      @macAddress= params['mac']

      if @model.to_s.first ==","
        @model = @model[1..-1]

      total_params = 1

      if @dataModel.include? (",")
        paramArray = @model.split(/\s*,\s*/)
        p "After Conversion"
        p paramArray

        total_params = paramArray.length

     if total_params==1

            if @macAddress.nil?
              redirect_to root_path
            elsif @model.nil?
              redirect_to root_path
            response=client.get_call(@macAddress, @dataModel)

            response_time = client.response_time

            p "RESPONSE_TIME = #{response_time}"

            p "Encoding = #{response.body.encoding}"


            p response.body

            if access_token.nil?
              response = sat_client.get_sat_token
              if response.code == "200"
                p "Storing Token in Redis"
                return access_token
                p "SAT endpoint returned #{response.code}"
                p "#{response.body}"
                raise "Retrieving SAT Token call failed"

            result_hash["response"]={"status": response.code,"parameter_name": @model.to_s, "body": response.body ,"accesstoken": access_token, "response_time": response_time.to_s};


        result_hash["response"]={"status": "520", "body": "" };



As error says you have problem with making connection. I can only guess it’s somewhere in ClientCall or SatClient class.