Skip to content
FunnelGuard

Fix guide by FunnelsGuard

413 or 431 error: request body or header too large, how to fix

OPS-087Medium impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Every web server, proxy and CDN sets a maximum size for what it accepts. When a request goes over that size, it is rejected before your site code runs. The two status codes are:

The two size errors and their usual causes
CodeMeaningTypical cause
413Content Too Large / Payload Too Large: the request body is over the limitFile uploads in forms, large JSON or base64 images, small default limits (Nginx defaults to 1 MB)
431Request Header Fields Too Large: the headers are over the limitToo many or too big cookies, long query strings, very long tracking parameters

Why it costs you leads or sales

Where a 413 stops a lead
  1. Visitor fills formAttaches a 6 MB photo
  2. SubmitBrowser sends the request
  3. Server limitReturns 413 Payload Too Large
  4. Form handlerNever runs
  5. Email and CRMNo lead recorded

The request is rejected at the server, so the form handler and CRM never see it.

A form submit refused with 413

The visitor sees an error and the lead is gone.

How to check if your site has it

Find out whether requests are being refused
  1. Reproduce it

    Submit your form with a large attachment (try 5 to 10 MB), then with none. If only the large one fails, a body limit is the cause.

  2. Open browser DevTools

    Go to the Network tab, submit again and look for a red request with status 413 or 431. The response headers often show which layer answered (nginx, cloudflare, awselb).

  3. Check the server logs

    Nginx logs 'client intended to send too large body' in error.log. Apache logs 'Request body exceeds' or 'request header field is too long'.

  4. Check cookie size for 431

    In DevTools, Application, Cookies, see how many cookies your domain sets. Several kilobytes in total can trigger a 431.

How to fix it

Raise the limit in your stack
  1. Raise PHP limits

    Set upload_max_filesize and post_max_size in php.ini, .user.ini or your host's PHP settings panel. post_max_size must be at least as big as upload_max_filesize.

  2. Raise the web server limit

    If you are behind Nginx, set client_max_body_size (see Custom code). Many managed hosts let you change this in their dashboard or through support.

  3. Check form plugin settings

    Your form plugin may have its own maximum file size. Align it with the server limits.

Nginx: allow 20 MB bodies and larger headersnginx
server {
    client_max_body_size 20m;
    large_client_header_buffers 4 16k;
}
PHP: matching settings (php.ini)text
upload_max_filesize = 20M
post_max_size = 25M
Fix a 431 caused by cookies
  1. List your cookies

    Find the largest cookies in DevTools and who sets them.

  2. Remove or shorten them

    Stop storing large data in cookies. Keep an ID in the cookie and the data on the server.

  3. Scope cookies correctly

    Set cookies on the narrowest domain and path so that sibling subdomains do not send each other's cookies.

How to confirm it's fixed

Confirmation checks
  • Submit the form with a file just under your new limit and see a success message
  • DevTools shows a 200 or redirect, not 413
  • The test lead arrives in the inbox and CRM
  • A browser with many existing cookies loads the site without a 431
  • A file over the limit shows a clear message, not a server error page

How to prevent it happening again

Large upload form

Before

  • Server default 1 MB body limit
  • Photo uploads fail with 413
  • No lead, no alert

After

  • Limits aligned across CDN, server and PHP
  • Size hint shown beside the field
  • Uploads succeed and leads arrive

How FunnelGuard handles this

Questions people ask

What does 413 Request Entity Too Large mean?

It means the server or a proxy refused your request because the body was larger than its allowed maximum. It most often happens when uploading a file through a form. Raising the limit in the layer that returned the error fixes it.

How do I fix 413 Request Entity Too Large in Nginx?

Set client_max_body_size in the http, server or location block, for example 20m. Run nginx -t to check the config and reload Nginx. Also raise upload_max_filesize and post_max_size in PHP if you use it.

Why is my form not submitting with a large file?

A limit on the server, PHP, a CDN or the form plugin is probably refusing the upload. Open DevTools, Network, and look for a 413 response. Compare the file size with each layer's limit.

What is a 431 Request Header Fields Too Large error?

It means the request headers, often the cookies, were bigger than the server accepts. It can affect a returning visitor on every page. Clearing cookies helps short term, and reducing cookie size fixes it for good.

Why do I get 431 errors only on some browsers?

Those browsers hold more or larger cookies for your domain, so their headers exceed the limit while a fresh browser does not. Check the cookies in DevTools and remove oversized ones.

Is it safe to set a very high upload limit?

It is better to set the smallest limit that fits your real use. Very high limits make it easier for someone to tie up your server with huge uploads. Pair a moderate limit with file type checks.

Can I fix a 413 on Shopify or Webflow?

You cannot change their server limits. Reduce file sizes, state the maximum on the form and cut cookies from apps or scripts. For big files, use an external upload service.

Can FunnelGuard detect 413 and 431 errors?

Yes. If a monitored journey step returns one of these errors, it fails and you get an alert with a screenshot and likely cause after a second-region re-check.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.