400 Bad Request: What It Means & How to Fix It

Key takeaway

A 400 Bad Request means the server received your request but refused to process it because something in it looked malformed: a broken URL, cookies or headers that are too big or corrupted, or invalid data sent to an API. As a visitor, check the URL for stray characters, then clear that one site's cookies and try a private window. As a site owner, read the error page and logs: "Request Header Or Cookie Too Large" means a header line, or all the headers together, didn't fit nginx's buffers (8 KB per line by default), so shrink cookies or raise the limit, and "The plain HTTP request was sent to HTTPS port" means something is speaking HTTP to a TLS port.

Check it now

400 Bad Request: Request Header Or Cookie Too Large nginx page with the fixes to try in order
400 Bad Request: Request Header Or Cookie Too Large nginx page with the fixes to try in order
Start reading
  1. What Is a 400 Bad Request Error?
  2. What a 400 Error Looks Like
  3. What Causes a 400 Bad Request?
  4. Fix 1: Check the URL
  5. Fix 2: Clear Cookies for That One Site
  6. Fix 3: Try Incognito, Then Clear the Cache
  7. Fix 4: Disable Extensions and Check File Sizes
  8. For Website Owners: Finding the Cause of 400 Errors
  9. "Request Header Or Cookie Too Large"
  10. "The plain HTTP request was sent to HTTPS port"
  11. 400 Errors From APIs
  12. 400 vs 401, 403, 404, 413, 429 and 431
  13. Frequently Asked Questions

What Is a 400 Bad Request Error?

400 Bad Request is an HTTP status code that means the server got your request but won't process it because something about the request itself looks wrong. The HTTP standard defines it as the server being unable or unwilling to process a request "due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing)" (RFC 9110 §15.5.1).

Unlike a 500 error, which means the server broke, a 400 points the finger at the request: the URL, the headers, the cookies or the data your browser or app sent. The website is usually working fine for everyone else.

That's good news for visitors, because the fix is often on your side and takes a minute: a mistyped or damaged link, or cookies that have grown too big for the server.

See the status code and headers a page returns

What a 400 Error Looks Like

The message depends on the server software, and the extra text is often the best clue to the cause:

ServerWhat the page saysUsual cause
nginx400 Bad Request: Request Header Or Cookie Too LargeCookies or headers over nginx's limit
nginx400 Bad Request: The plain HTTP request was sent to HTTPS portHTTP sent to a port that expects HTTPS
ApacheBad Request: Your browser sent a request that this server could not understand. (For an oversized header it adds: Size of a request header field exceeds server limit.)Malformed request or an oversized header field
IIS (HTTP.sys)Bad Request - Invalid URL. HTTP Error 400. The request URL is invalid.Illegal or badly encoded characters in the URL
IIS (HTTP.sys)Bad Request - Request Too Long. The size of the request headers is too long.Too many or too large cookies
Google400. That's an error. Your client has issued a malformed or illegal request.A malformed URL or request (oversized cookies get a 413 page instead)

What Causes a 400 Bad Request?

  • A malformed URL. A stray % sign, a space, a character that should have been encoded, or a link that was cut off or pasted twice.
  • Corrupted or oversized cookies. Sites that set many cookies (logins, A/B tests, analytics) can push the Cookie header past the server's limit. A cookie damaged during an update can also be rejected.
  • Too-large request headers. Besides cookies, long authentication tokens or headers added by extensions and proxies add up.
  • Invalid data sent to an API. Missing required fields, malformed JSON, or the wrong Content-Type header.
  • HTTP sent to an HTTPS port. Common behind load balancers and reverse proxies.
  • A file that's too large. Many servers reply 413 Content Too Large, but some apps and frameworks return 400 instead.

Fix 1: Check the URL

Look closely at the address bar. Problems to watch for:

  • A % that isn't followed by two hexadecimal characters (%20 is fine, %2 or %zz isn't).
  • Spaces, { }, |, \ or other unusual characters, especially in links copied from emails, PDFs or chat apps.
  • A link that was pasted twice (https://example.com/https://example.com/...) or cut off partway.
  • A very long URL with tracking parameters. Delete everything from the ? onwards and try again.

If you followed a link from another site, go to the site's homepage and navigate to the page from there instead.

Fix 2: Clear Cookies for That One Site

This is the fix for messages that mention cookies or headers being "too large" or "too long", and it's worth trying for any 400 on a site you've used before. You don't need to wipe cookies for every site, just this one:

  • Chrome: click View site information at the left of the address bar → Cookies and site data → Manage on-device site data → delete the site's data, then reload.
  • Edge: Settings → Privacy, search, and services → Cookies → See all cookies and site data → search for the site → delete it.
  • Firefox: click the padlock → Clear cookies and site data…
  • Safari (Mac): Safari → Settings → Privacy → Manage Website Data… → search for the site → Remove.
  • iPhone: Settings → Apps → Safari → Advanced → Website Data → swipe left on the site to delete.

Fix 3: Try Incognito, Then Clear the Cache

Open the page in an Incognito/Private window (Ctrl + Shift + N in Chrome and Edge, Ctrl + Shift + P in Firefox, Cmd + Shift + N in Safari). Private windows start with no cookies, no cached files and usually no extensions, so if the page works there, Fix 2, Fix 4 or clearing cached files (Ctrl + Shift + Delete → Cached images and files) will solve it permanently.

If Incognito also fails, your cookies, cache and extensions aren't the cause: check the URL again, turn off any VPN or proxy, and as a last step flush your DNS cache. DNS is rarely the cause of a 400, but after a site moves servers an outdated address can land you on a server that rejects your request.

Fix 4: Disable Extensions and Check File Sizes

Extensions that modify requests, such as privacy tools, header editors, coupon finders and some ad blockers, can add or change headers in ways a server rejects. Disable them all, reload, then turn them back on one at a time to find the culprit.

If the error appears when uploading, try a smaller file. Compress images or split large files. That tells you whether the server is rejecting the size, even if it reports it as a 400 instead of 413.

For Website Owners: Finding the Cause of 400 Errors

If users report 400 errors on your site, start with the exact message they see and your server logs. nginx logs the reason at the info level; Apache logs oversized headers at info but malformed URLs and headers only at debug, so raise the error log level temporarily if you don't see it (error_log … info; in nginx, LogLevel debug in Apache). The access log shows which URLs return 400. DNS Robot's HTTP Header Checker shows the status code, the server software and each cookie a first visit sets, with its size; cookies that scripts add later, such as analytics, only show in your browser's DevTools (Application → Cookies).

bash
# Which requests get 400? (nginx combined log format)
sudo awk '$9 == 400 {print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head

# The reasons nginx logged (needs error_log ... info;)
sudo grep -i "client sent\|too large\|bad request" /var/log/nginx/error.log | tail -20

nginx reads request headers into buffers set by large_client_header_buffers, by default 4 buffers of 8 KB. A header field that doesn't fit in one buffer, usually the Cookie header, gets this 400, and so do headers that need more than all 4 buffers together (about 32 KB); a request line (the URL) that's too long gets 414 instead (nginx). Apache's equivalent limit is LimitRequestFieldSize, 8,190 bytes by default (Apache).

We tested it on nginx.org itself (nginx 1.31.3) on 27 October 2026: a request with a 7,000-byte cookie got the normal page, and one with a 9,000-byte cookie got exactly this:

html
<html>
<head><title>400 Request Header Or Cookie Too Large</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>Request Header Or Cookie Too Large</center>
<hr><center>nginx/1.31.3</center>
</body>
</html>

The proper fix is to send less: remove cookies you no longer need, keep session cookies small, and scope cookies to the paths and subdomains that use them. If you really need bigger headers, for example for large single sign-on tokens, raise the limit:

nginx
# nginx: http block or the default server (other server blocks can be ignored)
large_client_header_buffers 4 16k;

# Apache equivalent: main config or the first-listed virtual host
# LimitRequestFieldSize 16380

"The plain HTTP request was sent to HTTPS port"

nginx returns this 400 when something sends plain HTTP to a port where nginx expects TLS, usually 443; curl http://nginx.org:443/ shows the page. Typical causes are a load balancer or proxy forwarding http:// traffic to port 443, a link with http://example.com:443, or, on nginx older than 1.25.1, an ssl on; line in a server block that also listens on port 80 (1.25.1 removed the directive and newer nginx won't start with it; use listen 443 ssl;).

Make sure each listen line matches what arrives on it: listen 443 ssl; for HTTPS and listen 80; for plain HTTP, with a redirect from 80 to 443. Also make sure the proxy in front talks HTTPS to 443 (or HTTP to 80).

400 Errors From APIs

APIs use 400 for requests that fail validation. If you're calling an API, read the response body, because most APIs explain which field is wrong. Then check that you send valid JSON, the right Content-Type: application/json header, and every required parameter.

If you're building an API, return a body that names the problem (for example, {"error": "email is required"}), and consider 422 Unprocessable Content for requests that are well-formed but semantically invalid, keeping 400 for requests that can't be parsed at all.

400 vs 401, 403, 404, 413, 429 and 431

CodeNameMeaning
400Bad RequestThe request is malformed or invalid
401UnauthorizedYou need to log in or send valid credentials
403ForbiddenThe server understood you but won't allow access
404Not FoundNothing exists at that URL
413Content Too LargeThe upload or request body is too big
429Too Many RequestsYou hit a rate limit
431Request Header Fields Too LargeHeaders, usually cookies, are too big (Node.js, for example, answers 431 where nginx says 400)

Our guides to the neighbours: 403 Forbidden, 401 Unauthorized and 429 Too Many Requests. For redirects that loop instead of failing, see ERR_TOO_MANY_REDIRECTS, and the Redirect Checker shows every hop.

If the server accepts the request format but not the HTTP method, you get 405 Method Not Allowed instead.

See exactly what a page returns

DNS Robot's HTTP Header Checker shows the status code, the server software and every cookie a site sets for any URL, so you can see whether a page returns 400 for everyone or only in your browser.

Sources

  1. RFC 9110 §15.5.1: 400 Bad Request, IETF
  2. large_client_header_buffers, nginx
  3. LimitRequestFieldSize, Apache HTTP Server
  4. How HTTP status codes affect Google's crawlers, Google

Frequently Asked Questions

What does 400 Bad Request mean?

It means the server received your request but refused to process it because something in the request looked malformed or invalid, such as a broken URL, oversized or corrupted cookies, headers that are too large, or invalid data sent to an API.

Is a 400 Bad Request my fault?

Usually the cause is in the request your browser sent, so the fix is often on your side: check the URL, clear that site's cookies, and try Incognito. But a server can also reject valid requests if its limits are set too low, so if nothing works, contact the site.

How do I fix 400 Bad Request in Chrome?

Check the URL for stray characters, open the page in an Incognito window, then delete that site's cookies: View site information at the left of the address bar → Cookies and site data → Manage on-device site data. If it continues, clear cached files and disable extensions one by one.

What does Request Header Or Cookie Too Large mean?

The browser sent a cookie or other header bigger than the server allows: on nginx, one header over 8 KB, or all headers together over about 32 KB, by default. As a visitor, clear that site's cookies. As a site owner, reduce the number and size of cookies, or raise nginx's large_client_header_buffers (default 4 × 8 KB) or Apache's LimitRequestFieldSize.

What does The plain HTTP request was sent to HTTPS port mean?

nginx received plain HTTP on a port configured for HTTPS. Use https:// in the URL, or as a site owner make sure your listen directives and any load balancer or proxy send HTTPS traffic to port 443 and HTTP traffic to port 80.

Can a VPN or DNS cause a 400 error?

Rarely. A proxy or security software that rewrites requests can, and after a site changes servers a stale DNS entry may send you to a server that rejects the request. Disconnecting the VPN and flushing DNS are worth trying after the URL, cookie and cache fixes.

What is the difference between 400 and 404?

400 means the request itself is malformed, so the server won't process it. 404 means the request was fine but nothing exists at that address.

Does a 400 error affect SEO?

Google treats 4xx responses other than 429 as content that doesn't exist, so a URL that keeps returning 400 drops out of search results. 4xx errors don't slow Googlebot's crawling of the rest of the site. Fix 400s on pages you want indexed.

Why do I get 400 Bad Request when uploading a file?

The file is probably larger than the server or app accepts, and it reports the problem as 400 instead of 413. Try a smaller or compressed file, or ask the site about its upload limit.

About the author

Shaik Vahid

Founder of DNS Robot. Vahid spent years in web hosting support fixing domains, DNS records, SSL certificates and email delivery for customers. He builds DNS Robot's tools and writes these guides from the errors people actually hit.

HTTP Header Checker

Response headers exactly as sent, with a Mozilla Observatory security grade