Sending data to the server with HTTP? Size matters

This post is more than 2 years old.

A few times a month I run into someone having issues with this and just a few minutes ago I helped someone out so I thought I'd write something up quickly to help make it (hopefully) a bit more Google-friendly for those having trouble.

The problem, and solution, is typically pretty simple. If you have found that your network calls to send data to the server are failing, check to see if you are doing a GET request. While according to Stack Overflow there is no real limit to the size of a GET request, there are practical and browser-specific limits that may impact you.

In general, if I'm building a form with a text area, I'll use a POST instead of a GET. If I'm sending a file than I'm definitely using POST.

To be clear, this isn't an "Ajax" issue, but a HTTP thing. The person who emailed me today was actually using the HTTPService in Flex.

I'll also add - it's probably a good idea to really think about how much data your user is sending to your server. Are there things you can do to minimize the size? Are you handling timeouts or other errors? On the server, are you checking how much free space you have available? Have you considered using S3 to bypass artificial limits on storage?

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Tom posted on 11/6/2012 at 4:28 PM

There is also a limit on the number of POST variables, regardless of size, that ColdFusion (at least CF9) will accept. The default is apparently 100.

The parameter is configurable and can be set in {cfhome}\lib\neo-runtime.xml by adding a postParametersLimit variable.

Comment 2 by Raymond Camden posted on 11/6/2012 at 4:54 PM

It is configurable directly in the Admin in 10.

Comment 3 by xavier posted on 8/30/2013 at 7:11 PM

I am facing a similar problem where I am running into a "502 Bad Gateway" error. I am using CFHTTP (method=Post) to post XML. I am having this problem only when the XML is exceeding a limit (around 7800 bytes).
I am able to post the same XML without a problem to my development server (http as opposed to https on the Production server). I am thinking it a size related problem, but I could be wrong. I tried increasing the 20 MB default for "Maximum size of post data" in the Administrator to 200 MB but that also did not help. Any idea what is going on? Thanks in advance.

Comment 4 by Raymond Camden posted on 9/3/2013 at 12:25 AM

Are you using CFHTTP to post to a CF server or another type of server?

Comment 5 (In reply to #3) by posted on 7/20/2016 at 12:08 PM

I have the same issue. DId you find a solution?