0

I am trying to send large base64 encoded string from client to server rails API and then decode it on the server side and upload the file to S3 or any other service. Whilst I was trying to send large encoded base64 string I am facing the following error:

2018-01-12 14:39:51 +0530: HTTP parse error, malformed request (): #<Puma::HttpParserError: HTTP element QUERY_STRING is longer than the (1024 * 10) allowed length (was 53799)>
---

Since base 64 encoded string is very large. I am attaching screenshot please seeenter image description here

I am using rails 5.2 beta and puma server. Please let me know if I need to share any more informations or correct anything

punitcse
  • 717
  • 7
  • 27
  • please any one give answer consider that I want to send request from a browser not from any other client. How would I do that? – punitcse Jan 12 '18 at 10:22

2 Answers2

2

As you can see here: What is the maximum possible length of a query string?

Some clients may imply a limit for the query string.

What you need to do, is to accept this string in the body of the request. Since your using Postman, you can do the following:

post with body

Rails by default will parser those values for value, and it'll be available on the @params hash.

Jonathan Duarte
  • 753
  • 5
  • 9
1

You're trying to POST a large object as a query parameter, which is not the intended use of parameters.

You need to post it as multipart/form-data.

See this Stackoverflow question for an example of how to do this with the rest-client gem.

mcfinnigan
  • 11,442
  • 35
  • 28