182

What is the specification for maximum data size one can send with HTTP POST method?

pppery
  • 3,731
  • 22
  • 33
  • 46
IAdapter
  • 62,595
  • 73
  • 179
  • 242

7 Answers7

230

Quite amazing how all answers talk about IIS, as if that were the only web server that mattered. Even back in 2010 when the question was asked, Apache had between 60% and 70% of the market share. Anyway,

  • The HTTP protocol does not specify a limit.
  • The POST method allows sending far more data than the GET method, which is limited by the URL length - about 2KB.
  • The maximum POST request body size is configured on the HTTP server and typically ranges from
    1MB to 2GB
  • The HTTP client (browser or other user agent) can have its own limitations. Therefore, the maximum POST body request size is min(serverMaximumSize, clientMaximumSize).

Here are the POST body sizes for some of the more popular HTTP servers:

Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404
  • 6
    Of those answers that mention a webserver two mention IIS and one mentions Apache. Anyway, have edited my answer to signpost towards yours which is more complete and up to date. – David Neale May 07 '19 at 07:59
  • 4
    Thank you @DavidNeale! There should be a [badge](https://meta.stackexchange.com/questions/327946/reward-someone-who-edited-their-answer-as-obsolete-to-point-to-mine) for that :) I'll try to keep this answer updated. Just added the maximum for nginx. – Dan Dascalescu May 09 '19 at 00:25
  • About this: "more data than the GET method, which is limited by the URL length - about 2KB." What about headers? Per [this post](https://stackoverflow.com/questions/686217/maximum-on-http-header-values) it appears that headers allow for about 8-16KB . – Hans Vonn Nov 06 '19 at 16:50
  • @DanDascalescu note that nginx is misspelled (as ngix) in the answer body and thus wasn't found initially in my text search. – Brad Hein May 03 '21 at 18:27
  • 1
    @BradHein: you have enough rep to edit answers; any reason why you didn't just do that? – Dan Dascalescu May 09 '21 at 00:37
  • Don't think we can say that GET method is limited by url length ~ 2kb, while GET request can have BODY which is actually seams limitless. Related: https://stackoverflow.com/questions/978061/http-get-with-request-body – Rustam A. Jan 10 '22 at 14:41
105

EDIT (2019) This answer is now pretty redundant but there is another answer with more relevant information.

It rather depends on the web server and web browser:

Internet explorer All versions 2GB-1
Mozilla Firefox All versions 2GB-1
IIS 1-5 2GB-1
IIS 6 4GB-1

Although IIS only support 200KB by default, the metabase needs amending to increase this.

http://www.motobit.com/help/scptutl/pa98.htm

The POST method itself does not have any limit on the size of data.

David Neale
  • 16,498
  • 6
  • 59
  • 85
  • upvote for mentioning Metabase.XML and I have listed various ways to change the file upload size limit because it might be useful. – Durai Amuthan.H Feb 12 '14 at 12:41
  • Entering following command in command prompt helps increase file upload size limit."cscript C:\inetpub\adminscripts\adsutil.vbs set w3svc/ASPMaxRequestEntityAllowed 10484880" (in bytes) reference:https://www.serverintellect.com/support/iis/uploaddownload-size-limits-iis6/ – Durai Amuthan.H Feb 12 '14 at 12:42
  • or find metabase.xml in C:\windows\sytem32\inetserv\ path and edit but make sure Enable Direct metabase edit is enabled.reference:http://www.banmanpro.com/support2/file_upload_limits.asp – Durai Amuthan.H Feb 12 '14 at 12:43
  • or In your web.config, add a line under your system.web http://weblogs.asp.net/mhawley/archive/2004/05/11/129824.aspx – Durai Amuthan.H Feb 12 '14 at 12:43
  • For current (2019) web servers, see [this answer](https://stackoverflow.com/questions/2880722/can-http-post-be-limitless/55998160#55998160). – Dan Dascalescu May 06 '19 at 02:40
36

There is no limit according to the HTTP protocol itself, but implementations will have a practical upper limit. I have sent data exceeding 4 GB using POST to Apache, but some servers did have a limit of 4 GB at the time.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • Is 4GB still the maximum for Apache? I've [found it documented](https://stackoverflow.com/questions/2880722/can-http-post-be-limitless/55998160#55998160) to be 2GB. – Dan Dascalescu May 06 '19 at 02:39
  • @DanDascalescu: I don't know, I haven't done this in a long time. Perhaps they started imposing an upper limit on the `LimitRequestBody` directive. – Greg Hewgill May 06 '19 at 03:25
7

POST allows for an arbitrary length of data to be sent to a server, but there are limitations based on timeouts/bandwidth etc.

I think basically, it's safer to assume that it's not okay to send lots of data.

Russ Clarke
  • 17,511
  • 4
  • 41
  • 45
3

Different IIS web servers can process different amounts of data in the 'header', according to this (now deleted) article; http://classicasp.aspfaq.com/forms/what-is-the-limit-on-form/post-parameters.html;

Note that there is no limit on the number of FORM elements you can pass via POST, but only on the aggregate size of all name/value pairs. While GET is limited to as low as 1024 characters, POST data is limited to 2 MB on IIS 4.0, and 128 KB on IIS 5.0. Each name/value is limited to 1024 characters, as imposed by the SGML spec. Of course this does not apply to files uploaded using enctype='multipart/form-data' ... I have had no problems uploading files in the 90 - 100 MB range using IIS 5.0, aside from having to increase the server.scriptTimeout value as well as my patience!

Matt
  • 74,352
  • 26
  • 153
  • 180
amelvin
  • 8,919
  • 4
  • 38
  • 59
  • 1
    Good edit @Matt - shows the importance of snipping out the salient facts rather than blindly linking – amelvin May 12 '16 at 13:59
2

HTTP may not have an upper limit, but webservers may have one. In ASP.NET there is a default accept-limit of 4 MB, but you (the developer/webmaster) can change that to be higher or lower.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Hans Kesting
  • 38,117
  • 9
  • 79
  • 111
2

In an application I was developing I ran into what appeared to be a POST limit of about 2KB. It turned out to be that I was accidentally encoding the parameters into the URL instead of passing them in the body. So if you're running into a problem there, there is definitely a very small limit on the size of POST data you can send encoded into the URL.

brycejl
  • 1,411
  • 17
  • 22