What is the size limit of an HTTP POST request?
There is a pervasive myth in web development that the POST method has a hard, intrinsic ceiling on data volume. Many developers assume that because GET requests are limited by URL length constraints (typically 2048 characters depending on the browser and server), POST must be similarly restricted. The short answer is that HTTP itself imposes no such limit. However, in practice, you will almost certainly hit a wall before your application logic ever fails to process the data.
When you submit an XML string or large JSON payload from a Flex application using HTTPService, the bottleneck is rarely the protocol. It is the software stack sitting between your client and your database. To handle payloads up to 5 MB or larger, you must understand exactly where each component of your architecture enforces its own limits.
The Browser Side: Client Constraints
In a typical Flex-to-IE deployment, the browser acts as the first gatekeeper. Internet Explorer has historically been notoriously conservative regarding memory management and buffer sizes. While modern standards-compliant browsers generally handle large POST bodies without issue, IE often flags requests exceeding specific thresholds or hangs while parsing massive responses.
If you are targeting legacy environments like IE, you must be aware that the browser may refuse to send a request if it detects an excessively large body, even if the server would accept it. This is not a protocol violation but a client-side safeguard against running out of RAM or triggering a disk spill that causes a crash. If your Flex application attempts to post 5 MB via HTTPService in IE, you are fighting against the browser's internal buffer limits and its tendency to time out on long-running network operations.
The Server Configuration: PHP and Apache/Nginx
Once the request leaves the browser, it hits your web server. If you are running PHP behind Apache or Nginx, the most common point of failure is the post_max_size directive. This setting dictates the maximum size of a POST body that the server will accept. By default, many shared hosting environments set this to 8 MB or even lower (e.g., 1 MB).
If your PHP script receives a request larger than post_max_size, the server silently truncates the data or rejects it entirely with a 413 Request Entity Too Large error. You must explicitly configure this value in your php.ini file or via an .htaccess override:
post_max_size = 8M
It is crucial to remember that post_max_size must be slightly smaller than your upload_max_filesize (if applicable) and definitely smaller than the client_max_body_size configured in your web server. If you only increase upload_max_filesize but leave post_max_size at its default, your large XML payloads will still be rejected before they ever reach your MySQL database.
The Web Server: Apache and Nginx Limits
Beyond PHP's internal limits, the web server itself enforces a hard cap on the size of incoming requests. In Apache, this is controlled by LimitRequestBody in the <Directory> block or via mod_rewrite. If not explicitly set, it defaults to 0 (unlimited), but many hosting providers override this globally.
Nginx uses the client_max_body_size directive:
http {
client_max_body_size 10M;
}
If a request exceeds this limit, Nginx returns a 413 error immediately, bypassing PHP entirely. When debugging these issues, check the server logs first. A sudden spike in client_max_body_size errors indicates the web server is rejecting valid requests before your application code runs.
The Database: MySQL Capacity
Assuming you clear the client and server hurdles, your data arrives at MySQL. Here, the limitation is not about the size of a single packet but rather how the storage engine handles large transactions. If you are inserting 5 MB of XML into a TEXT or LONGTEXT column, ensure your InnoDB configuration (innodb_buffer_pool_size) can accommodate the transaction log growth during the write operation.
While MySQL does not have a strict "row size" limit in the same way it has limits on individual columns (which are 64 KB for standard types), very large rows can cause issues with page splitting and locking. A single row exceeding 8 KB becomes a "large row," which requires more disk I/O to write and increases the risk of deadlocks if multiple processes try to update overlapping data ranges. For XML payloads, it is often better to store the data in a separate column or use JSON columns (available in MySQL 5.7+) that handle larger structures more efficiently than legacy TEXT types.
Conclusion
There is no universal HTTP limit for POST requests, but your specific stackâInternet Explorer, PHP, and MySQLâeach imposes practical constraints. To safely post a 5 MB XML string:
- Increase
post_max_sizein PHP to at least 5 MB (preferably 8 MB). - Adjust
client_max_body_sizein Nginx orLimitRequestBodyin Apache to match your needs. - Test thoroughly in Internet Explorer, as its memory management is the most likely point of failure for large payloads.
Ignoring these configuration details will lead to silent data loss or hard failures that are difficult to trace without checking server logs and client-side developer tools.