Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cookie too large, server 400 error: how to find and fix it

CNV-377Medium impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Every time a browser asks your site for a page, it attaches all cookies for that domain in a request header called Cookie. Web servers and proxies cap the size of request headers. If the total goes over the cap, the server refuses the request with a 400 Bad Request (or sometimes a 431 "Request Header Fields Too Large") before your site's code even runs.

Why it costs you leads or sales

The people most likely to hit this are returning visitors: past customers, people who browsed your shop several times, and people coming back from ads. They are often your warmest traffic. They see an error page instead of your form or checkout, and most will not think to clear their cookies.

It is also hard to spot. Your own test in a clean browser works, analytics show nothing because the page never loaded, and the error often depends on which cookies a person has collected.

Where a returning visitor gets stuck
  1. Ad clickVisitor returns to your site
  2. Request sentBrowser attaches a very large Cookie header
  3. Server 400Header over the limit, request refused
  4. Form or checkoutNever shown
  5. Lead or saleNot recorded

The server rejects the request before the page is built, so every later step is lost.

A returning visitor meets the error

The page fails to load, so nothing on it can convert or be tracked.

How to check if your site has it

Check for an oversized cookie problem
  1. Reproduce with a returning browser profile

    Open your site in a browser you have used on it for a long time, or one that has visited many pages and logged in. A fresh private window will often hide the problem.

  2. Look at the error text

    Search the page for "Request Header or Cookie Too Large", "400 Bad Request" or "431". Note which server name appears at the bottom (nginx, Apache, Cloudflare and so on).

  3. Inspect the cookies

    In Chrome open DevTools, go to Application, then Cookies, and select your domain. Sort by size. Note the largest cookies and how many there are. Browsers allow about 4 KB per cookie, but the combined header is what matters.

  4. Check the request header size

    In DevTools open the Network tab, click a request and read the Cookie line under Request Headers. Compare its length with your server's limit (nginx default is 8 KB for all headers, Apache's default is 8190 bytes per header line).

  5. Test subdomains too

    Cookies set on .yourdomain.com are sent to every subdomain. A large cookie from one app can break another, such as your shop or booking page.

How to fix it

There are two parts: reduce what is stored in cookies (the real fix), and give the server some headroom (the backstop). Start with the first.

Fix an oversized cookie
  1. Identify the biggest and the fastest-growing cookies

    Compare the cookie list for a new visitor and a returning one. Cookies that keep growing, such as cart data, recently viewed lists, A/B test histories, referral or attribution trails, are the usual cause.

  2. Find where each one is set

    Match the cookie name to a plugin, app, tag or your own code. Check the Domain column: cookies on the root domain are sent to every subdomain.

  3. Store less in the cookie

    Keep only a short ID in the cookie and store the data on the server or in localStorage. Stop saving full URLs, long query strings or JSON blobs in cookies.

  4. Limit scope and lifetime

    Set cookies for the exact host that needs them rather than the root domain, and give them a sensible expiry so old ones do not pile up.

  5. Remove cookies you do not need

    Delete duplicate or abandoned tracking tags and plugins. Each leaves its own cookies behind.

  6. Raise the server limit as a backstop

    Only after shrinking cookies, increase the header buffer. See the snippets below. A higher limit hides growth, it does not stop it.

Where to look on each platform
  1. Find the plugin setting cookies

    Deactivate plugins one at a time (start with caching, membership, WooCommerce add-ons, A/B testing and tracking plugins) and re-check the cookie list after each one.

  2. Check custom code

    Search your theme or child theme for setcookie( and remove anything that stores large values.

  3. Ask your host about header limits

    On managed hosting the limit is set by the host. Contact support if the error persists after cookies are reduced.

Nginx: allow larger request headers (backstop)nginx
# in the http or server block
large_client_header_buffers 4 16k;
client_header_buffer_size 4k;
Apache: allow longer header lines (backstop)text
# in httpd.conf or the virtual host
LimitRequestFieldSize 16380
Cookie handling before and after

Before

  • Full URLs and JSON stored in cookies
  • Cookies set on the root domain and sent everywhere
  • Old tracking tags still writing cookies
  • Returning visitors see a 400 error

After

  • Short IDs in cookies, data kept server-side
  • Cookies scoped to the host that needs them
  • Unused tags and plugins removed
  • Returning visitors load the page normally

How to confirm it's fixed

Confirmation checklist
  • Reload the page in the browser profile that failed and it loads without a 400
  • The total Cookie header in DevTools is well under your server limit
  • The biggest cookie no longer grows after several page views and a few days of use
  • Subdomains such as shop, app and booking pages also load
  • Your form, checkout or booking button works on a returning visitor profile

How to prevent it happening again

Prevention checklist
  • Review installed plugins, apps and tags every quarter and remove unused ones
  • Do not store URLs, query strings or JSON in cookies
  • Scope cookies to the host that needs them and set an expiry
  • Test new tools with a long-used browser profile, not only a clean window
  • Check cookie sizes after adding any new tracking, A/B testing or personalization tool
  • Keep a note of your server header limits so you know your headroom

How FunnelGuard handles this

FunnelGuard detects this today as a page load error. A robot visitor runs your real customer journeys on a schedule, and if a page returns an error such as a 400 instead of loading, the step fails. The failure is re-checked from a second region before one alert goes out, with a screenshot and a likely cause.

Be aware of the limit: the check flags the failed page load. The robot may not carry the same pile of cookies as a long-time customer, so it will not always reproduce an error that only hits heavy returning visitors. You still need to inspect cookie sizes yourself to find the root cause. Free plan: 1 site, 2 journeys, daily checks, no card. Paid plans have a 3-day free trial.

Common signs and what they suggest
What you seeLikely meaning
400 only for returning visitorsCookies grew over time
Fixed after clearing cookiesOversized cookie confirmed
One subdomain fails, others workRoot-domain cookie too large for that host's limit
Error says 431Same cause, different status code

Questions people ask

Why am I getting "400 Bad Request: Request Header or Cookie Too Large"?

Your browser is sending more cookie data than the server accepts in one request. The server refuses it with a 400 before loading the page. Clearing cookies for the site usually removes the error for you, but the cause is a cookie that is too big or too many cookies.

How do I fix a cookie too large error on my website?

Find the largest or fastest-growing cookies in your browser's DevTools, trace them to the plugin, app or script that sets them, and store less in them. Remove unused tags and plugins, scope cookies to the right host and set expiry dates. Raising the server header limit can help as a backstop.

Why does the error only happen to some visitors?

Cookies build up with use. New visitors have few and load fine, while returning visitors may have collected many or very large ones. That is why the issue often goes unnoticed in clean test browsers.

What is the cookie size limit?

Browsers generally allow about 4 KB per cookie. Servers limit the total size of request headers, and defaults vary, for example about 8 KB in nginx. The combined Cookie header is what triggers the error.

How do I increase the header size limit in nginx or Apache?

In nginx raise large_client_header_buffers, for example to 4 16k. In Apache raise LimitRequestFieldSize. Reload the server afterwards. Treat this as a backstop and still reduce cookie size.

Does a 400 cookie error affect my SEO and ads?

The error mostly hits returning visitors with large cookies, so search crawlers usually do not see it. It still loses leads and sales from your warmest traffic, and tracking cannot record visits where the page never loaded.

Can FunnelGuard detect a cookie too large error?

FunnelGuard detects it as a page load error when a monitored journey step returns an error instead of the page. It re-checks from a second region and alerts with a screenshot and likely cause. It may not reproduce errors that depend on a long cookie history.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: page load error.

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.