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.
- Ad clickVisitor returns to your site
- Request sentBrowser attaches a very large Cookie header
- Server 400Header over the limit, request refused
- Form or checkoutNever shown
- Lead or saleNot recorded
The server rejects the request before the page is built, so every later step is lost.
The page fails to load, so nothing on it can convert or be tracked.
How to check if your site has it
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.
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).
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.
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).
Test subdomains too
Cookies set on
.yourdomain.comare 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.
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.
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.
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.
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.
Remove cookies you do not need
Delete duplicate or abandoned tracking tags and plugins. Each leaves its own cookies behind.
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.
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.
Check custom code
Search your theme or child theme for
setcookie(and remove anything that stores large values.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.
Audit installed apps
Open Apps in the admin and remove apps you no longer use. Some leave scripts in the theme after uninstalling, so check theme.liquid for leftover code.
Review custom cookie code
In Online Store, Themes, Edit code, search for
document.cookieand shorten any large values you set.Server limits
Shopify controls the server, so you cannot change header limits. Reduce cookies instead.
Find tags that write cookies
Look for Custom HTML tags and cookie-setting variables. Check whether any store full landing page URLs or long parameter strings.
Shorten stored values
Store just a source name or a short ID, not the entire URL.
Pause old tags
Pause tags from past campaigns and test again in Preview mode.
Check custom code
In Project settings, Custom code, and on page-level embeds, search for scripts that write cookies and shorten them.
Check third-party embeds
Remove unused scripts such as old chat, popup or A/B tools.
Review tracking code
In Sites settings and each funnel or page's custom code area, remove old tracking snippets.
Check custom domains
If you run several funnels on subdomains of one domain, cookies set on the root domain are shared. Keep each tool's cookies scoped to its own host.
Review added scripts
In Settings, Custom code, remove tracking snippets you no longer use.
Server limits
Wix manages the server, so reducing cookies from your own code and apps is the only lever.
Review code injection
In Settings, Advanced, Code Injection, remove old scripts that set cookies.
Server limits
Squarespace manages the server, so reduce cookies on your side.
Store data server-side
Keep a short session ID in the cookie and put the data in your database or cache.
Raise header limits if needed
Adjust nginx or Apache settings as shown below, then reload the server.
# in the http or server block
large_client_header_buffers 4 16k;
client_header_buffer_size 4k;# in httpd.conf or the virtual host
LimitRequestFieldSize 16380Before
- 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
- 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
- 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.
| What you see | Likely meaning |
|---|---|
| 400 only for returning visitors | Cookies grew over time |
| Fixed after clearing cookies | Oversized cookie confirmed |
| One subdomain fails, others work | Root-domain cookie too large for that host's limit |
| Error says 431 | Same 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.
Related issues
- CNV-376Session cookie lost between stepsFix guide
- CNV-378SameSite settings break iframe login/checkoutFix guide
- CNV-380CSRF token expired, form rejects submitFix guide
- CNV-381Cached page serves stale CSRF/nonce (WordPress cache)Fix guide
- CNV-382Logged-in cache served to visitorsFix guide
- CNV-383Cookie consent state not respected after choiceFix guide