Cloudflare Error 413 can prevent a file upload even when the website loads normally, the server has enough storage and smaller files upload without problems. The error means the HTTP request body exceeds a size limit enforced by Cloudflare, the origin server or another component handling the request.

The solution is to identify which component rejected the upload and correct the restriction responsible. Start by inspecting the failed HTTP request, compare its size with Cloudflare's configured maximum and investigate the origin only if Cloudflare's limit does not explain the failure.

Inspect the Failed Upload

Before changing upload settings, confirm that the failed request actually returns HTTP 413. A website may display a general upload error even when the underlying problem involves authentication, storage permissions or an application-specific restriction.

Open the affected upload page in Chrome or Microsoft Edge, press F12 and select the Network tab. Enable Preserve log if the page reloads or redirects when the upload fails.

Repeat the upload once using a file that is safe to submit. Find the failed request in the Network panel and inspect its headers, response and destination.

Record these details:

  • Request URL: The endpoint receiving the file.

  • HTTP method: Usually POST or PUT.

  • Status code: Confirm whether the response is 413.

  • File size: The size of the original file.

  • Request size: The Content-Length value, if available.

  • Response details: The error message, relevant headers and Cloudflare Ray ID when present.

  • Failure time: The timestamp and timezone.

Pay particular attention to the request destination because a file-upload form may appear on one hostname while sending its data to another API or upload service. The destination determines which upload restrictions apply, so do not assume that every upload initiated from a Cloudflare-protected website passes through the same proxy configuration.

If the request goes directly to Cloudflare R2 rather than through the website's normal upload endpoint, the failure needs a different investigation. BusinessTally's existing guide to Cloudflare R2 bucket upload failures covers that separate transfer problem.

Compare the File and Request Sizes

The original file size is not necessarily the complete HTTP request size. With multipart/form-data, the request also contains form boundaries, field information and possibly additional data.

For example, a file close to a 100 MB limit may produce a request body that exceeds the limit after multipart overhead is included. When the file is near the maximum, compare the full request size rather than relying only on the file's displayed size.

If the browser does not show a Content-Length header, inspect the upload request through the application's existing diagnostic tools or server logs. A missing Content-Length header does not automatically mean the request has no body or that its size can not be restricted.

Find Who Returned 413

HTTP 413 can originate at Cloudflare or at a server behind it. Both can appear in the browser as failed uploads but they require different corrections.

Inspect the failed request's response body and headers, then compare them with any corresponding origin logs. This helps determine which component should be investigated first.

EvidenceWhat it suggestsNext action
Cloudflare-generated 413 pageCloudflare may have rejected the requestCheck Maximum Upload Size
Origin access log records HTTP 413Origin server or application rejected the requestCheck server limits
Request exceeds the Cloudflare plan limitCloudflare's restriction is a likely causeVerify the configured maximum
Request is below Cloudflare's maximumAnother restriction may existInspect origin configuration
No corresponding origin request appearsRequest may have been rejected before the originCheck Cloudflare evidence and logging

A cf-ray header or server: cloudflare header alone does not prove that Cloudflare generated the 413 response. Cloudflare may forward an origin-generated error while adding its normal response headers.

Similarly, the absence of an origin access-log entry is not conclusive unless the relevant request logging is enabled. Some rejected requests may be logged differently depending on the web server and application configuration.

If Cloudflare's maximum explains the failure, investigate that restriction first. If the request is within Cloudflare's allowed size and the origin reports HTTP 413, proceed directly to the applicable origin limit.

Check Cloudflare's Upload Limit

For requests passing through a Cloudflare-proxied domain, the available upload limit depends on the domain's Cloudflare plan and its configured Maximum Upload Size.

Cloudflare documents the following limits for incoming request bodies:

Cloudflare planMaximum incoming upload
Free100 MB
Pro100 MB
Business200 MB
EnterpriseUp to 5 GB

Enterprise customers can configure supported values up to 5 GB themselves. Requests requiring a higher limit need additional arrangements with Cloudflare.

Check the Configured Setting

Open the Cloudflare dashboard, select the affected domain and navigate to Network → Maximum Upload Size.

Compare the configured value with the actual HTTP request size recorded earlier. A zone can have a lower configured maximum than the highest value permitted by its plan.

For example, a Business plan supports uploads up to 200 MB, but a domain configured with a 100 MB maximum can still reject a 150 MB request. This means the plan's advertised maximum is not necessarily the active limit for the affected hostname.

If the setting is lower than necessary, select an appropriate value supported by the plan and save the change. Avoid increasing it beyond the application's legitimate requirements because large uploads consume additional network and server resources.

Repeat the original upload after the setting takes effect and verify that the application receives the complete file. If the request still returns HTTP 413 despite being within Cloudflare's configured maximum, investigate whether another component enforces a lower restriction.

When the Plan Limit Is Too Small

Suppose a website on Cloudflare Pro needs to accept a 150 MB file through a single proxied request. Increasing Nginx or PHP limits to 200 MB will not overcome Cloudflare Pro's 100 MB request-body limit.

In that situation, the application must use smaller independent upload requests, move to a plan supporting the required size, or use an appropriately secured upload route that does not depend on the same proxy restriction. The appropriate choice depends on how the application receives and processes uploaded files.

For applications that regularly accept large files, multipart or resumable uploading may be more practical than relying on one large HTTP request. The receiving application must support that workflow, including storing and assembling the uploaded parts correctly.

Do not switch the main production hostname to DNS-only simply to bypass the limit. That removes Cloudflare's normal reverse-proxy protection from traffic to that hostname.

Check the Origin's Upload Limit

If the original request is within Cloudflare's configured maximum, inspect the software receiving the upload. The origin web server or application may enforce a much smaller request-size limit.

For example, a 20 MB upload can fail at Nginx even when Cloudflare allows 100 MB. Increasing Cloudflare's maximum would have no effect if Nginx is still rejecting the request.

Choose the relevant configuration according to the software actually handling the endpoint. You do not need to change Nginx, Apache and PHP settings together unless your application genuinely uses those components and their restrictions contribute to the failure.

Nginx

Nginx uses the client_max_body_size directive to limit the size of incoming request bodies. Its documented default is 1m when no other value is configured in the applicable context.

On a Linux server with administrative access, inspect the loaded configuration using sudo nginx -T 2>/dev/null | grep -n "client_max_body_size". This displays matching directives but does not establish which one applies to the failed upload.

Review the corresponding http, server and location configuration contexts to identify the effective setting for the upload endpoint. If no matching directive is configured, check whether the documented default is responsible.

For an application that legitimately accepts individual files up to approximately 60 MiB, an administrator might configure client_max_body_size 80m; in the appropriate Nginx context. The additional allowance accommodates multipart overhead and other request data.

The configured value should remain within the applicable Cloudflare limit and any restrictions imposed by the application. Add or modify the directive in the existing configuration context rather than creating an unrelated location block.

Before applying the change, run sudo nginx -t to validate the configuration. If validation succeeds, reload Nginx through the hosting environment's supported procedure, commonly sudo systemctl reload nginx on a system using systemd.

Do not reload the service if validation reports an error. Correct the configuration first, then confirm that Nginx is using the intended directive.

Repeat the original upload and observe its HTTP status. If Nginx still returns HTTP 413, inspect whether another matching configuration context or upstream gateway enforces a smaller request-body limit.

Apache

Apache can restrict incoming request bodies using LimitRequestBody. The directive may be configured at the server, virtual-host, directory or supported .htaccess level.

Ask the server administrator to inspect the configuration that applies to the failed upload endpoint. A restrictive value may exist even when the website's application settings permit larger files.

For an application requiring an 80 MiB request-body limit, an example directive is LimitRequestBody 83886080. The value is specified in bytes and should be selected according to the application's actual requirements.

Apply the directive only within an appropriate configuration context rather than unnecessarily increasing limits across unrelated applications. Follow the hosting environment's configuration-validation and reload procedure before repeating the original upload.

If the origin continues returning HTTP 413, inspect any reverse proxy or application gateway positioned before Apache. Repeatedly increasing the same directive will not resolve a lower restriction enforced elsewhere.

PHP

PHP applications can impose additional upload restrictions through upload_max_filesize and post_max_size. These settings control different parts of the upload request and must be configured consistently.

PHP settingPurpose
upload_max_filesizeMaximum size of an individual uploaded file
post_max_sizeMaximum total size of the POST request body

The POST limit needs enough room for the uploaded file and any additional form data or multipart overhead. For an application designed to accept files up to 60 MiB, example settings are upload_max_filesize = 60M and post_max_size = 72M.

These values are illustrative rather than universal recommendations. Applications accepting multiple files in one request may need a larger POST allowance, depending on the combined file sizes and other submitted data.

Verify the configuration used by the web-serving PHP process. Running php -i from a terminal may show settings from command-line PHP rather than the PHP-FPM environment serving the website.

An important distinction is that exceeding PHP's post_max_size does not necessarily generate HTTP 413 automatically. PHP may leave $_POST and $_FILES empty and the application may display its own error or return a different HTTP status.

If the browser specifically reports HTTP 413, verify which component generated that response. Do not assume PHP is responsible merely because one of its upload-size settings is low.

After adjusting the relevant PHP configuration through the supported hosting controls, confirm that the web application is using the updated values. Repeat the original upload and check whether the application receives the file successfully.

Find a Hidden Size Restriction

If Cloudflare and the relevant origin components appear correctly configured but HTTP 413 continues, another request-handling component may be enforcing a smaller limit.

A useful way to narrow the problem is to compare successful and unsuccessful request sizes using the same endpoint. This works best in staging or another authorized testing environment where uploaded files can be removed safely.

Test the Suspected Threshold

Use files of the same permitted format and compare their results. Keep the upload endpoint, authentication and form fields consistent so the test results remain meaningful.

For example:

Test fileIllustrative resultWhat it suggests
2 MBSuccessSmall requests are accepted
10 MBSuccessEffective limit exceeds this request size
20 MBHTTP 413A restriction may exist below this request size
15 MBSuccessThe suspected threshold is narrowed

These are example outcomes, not measurements from an actual Cloudflare deployment. The purpose is to identify a repeatable threshold that can be compared with the effective limits of each request-handling component.

If 15 MB succeeds while 20 MB repeatedly returns HTTP 413, check for a configured restriction near that range. Compare the complete request-body size where available because multipart overhead can affect the result.

Inspect the Response With cURL

For a staging endpoint that supports multipart uploads, cURL can capture the HTTP status and response headers independently of the browser interface.

Use a test file and endpoint that you are authorized to access. For example, the following command submits a multipart form field named file and displays the returned headers and HTTP status:

curl -sS \
  -D - \
  -o /dev/null \
  -w '\nHTTP status: %{http_code}\n' \
  -F "file=@./approved-test.jpg" \
  https://staging.example.com/upload

Replace the example endpoint and file with your actual staging values. The form field named file must also match the receiving application's expected field name.

This command displays response headers and the HTTP status while discarding the response body. It does not reproduce the browser request exactly unless the method, authentication, endpoint and submitted fields match.

If the application requires authentication, use an approved test account and avoid exposing credentials in shared logs or terminal screenshots.

When the request consistently returns HTTP 413 above a specific size, investigate a lower limit in the remaining gateway, reverse proxy or application configuration. If even very small files fail, verify that the reported status is genuinely associated with request size rather than an unrelated application response.

When the File Exceeds the Allowed Limit

When the file's complete request body exceeds Cloudflare's supported maximum, changing origin settings can not make that single proxied upload succeed.

For an application that must accept larger files, consider a genuine multi-request upload design. The application can transfer smaller parts separately and assemble the completed file after validating that every part arrived.

For example, a 240 MB file could be divided into six 40 MB upload requests if the application supports receiving and reconstructing those parts. Each request must remain within the applicable limits, including any multipart overhead.

The receiving application must also handle interrupted transfers, duplicate parts and incomplete uploads safely. Splitting a file without a compatible server-side implementation will not resolve the problem.

Changing the HTTP transfer encoding alone is not equivalent to implementing a supported multi-request upload workflow. Cloudflare's request-size restriction still needs to be respected.

If a separate DNS-only upload hostname is necessary, evaluate its HTTPS configuration, authentication, access controls and exposure to direct traffic before deployment. Avoid weakening the main website's protection simply to accommodate oversized uploads.

HTTP 413 Still Appears?

If the original upload continues failing after the suspected restriction has been corrected, compare the new result with the initial failure evidence. Determine whether the problem remains at the same size threshold, affects a different endpoint or now produces a different HTTP response.

Use the following recovery decisions instead of increasing every upload setting:

Remaining symptomNext action
Request exceeds Cloudflare's configured maximumUse a supported larger limit or smaller requests
Request is within Cloudflare's maximumCheck the origin-generated response and effective server limits
Nginx change has no effectCheck whether another server or gateway handles the endpoint
PHP change has no effectCheck application-level validation and remaining restrictions
One upload endpoint works but another returns 413Compare their gateways and application settings
Only larger multipart requests failCheck each request's complete body size
No component clearly explains the rejectionCollect request-specific evidence for the responsible provider

Follow the Remaining Evidence

If the failure threshold has not changed, concentrate on components that were not addressed by the original correction. These may include a hosting gateway, an upstream reverse proxy or an application-specific restriction.

If the response changes from HTTP 413 to another status code, investigate the new error instead of continuing to increase upload limits. For example, a request that is now accepted but fails during application processing may have a separate timeout or storage problem.

On managed hosting, ask the provider whether a platform-level request-size restriction exists. Some limits cannot be changed from ordinary website configuration files, even when application and web server settings permit larger uploads.

Escalate With the Failed Request

If the rejecting component remains unclear, collect the information necessary for your hosting provider or Cloudflare support to investigate.

Include the affected URL, HTTP method, response status, original file size, complete request size when known, timestamp and Cloudflare Ray ID when available. Also record the smallest failing request and largest successful request from your controlled tests.

Provide the Cloudflare plan, configured Maximum Upload Size and relevant origin limits. Explain which configuration changes were made and whether they affected the observed failure threshold.

Remove authentication headers, cookies, tokens and private file contents before sharing diagnostic information. The provider should receive enough evidence to investigate the restriction without unnecessarily exposing sensitive data.

Ask the provider to identify which component generated HTTP 413 and which request-body limit it enforced. This directs the investigation toward the unresolved restriction rather than encouraging another general increase to upload settings.

Confirm the Original File Uploads

After correcting the identified restriction, upload the original file through the website's normal interface. Confirm that the request finishes without HTTP 413 and that the application reports successful processing.

An upload progress indicator reaching 100% does not necessarily establish that the complete file was stored. Verify the result through the application's normal file-management interface.

Check that the uploaded file appears in the intended location, has the expected size and can be opened or processed correctly. Where file integrity is important, use an appropriate checksum or another supported verification method.

If the original upload problem occurred intermittently, repeat the test under comparable conditions and confirm that the correction remains effective. A successful small test file alone is not sufficient evidence when the original large file still fails.

The problem is resolved when the component enforcing the incorrect restriction has been identified, the appropriate limit or upload design has been corrected and the original file completes its intended upload successfully. Verification should use the original failing operation rather than relying on a separate test that does not reproduce the same request conditions.

If the response changes from HTTP 413 to an origin-response timeout such as Error 524, investigate that new error separately. An upload that passes the size restriction may still encounter an origin-processing timeout.