Reference guide · http-status · Published 2026-08-15 · 4 min read

HTTP 400 bad request

HTTP 400 bad request explained: causes from malformed syntax to oversized headers and cookie bombs, with an ordered fix list and a quick error table.

What a 400 means

A 400 Bad Request is the server telling the client that the request was malformed: the bytes arrived, but the request line, headers, or body violated the syntax the server could accept. No credentials can unlock it, and unlike 404 the path may exist on disk. As a rule of thumb, the fault is a client-side fault, so the fix starts on the requesting side, even when "the client" is a browser extension or a form nobody touched.

Table of the 4xx that look alike

StatusPlain meaningExampleFix direction
400Malformed requestInvalid JSON bodyFix the client or the stored request
401Missing or bad credentialsNo Bearer tokenAdd correct auth header
403Known but not allowedIP rule, permissionChange rule or permissions
404URL does not existDead slugRedirect or restore the page
429Rate limit hitToo many requestsBack off or raise the limit

Common causes

The ordered fix list

  1. Reproduce the failure. Open DevTools, switch to the Network tab, reload, and save the failing request as a HAR. Look for the response headers: a WAF, the origin, or the app may include the reason in the body or a header.
  2. Clear the cookie jar if the page itself 400s. The most common static cause is the session cookie exceeding the header limit. Clear cookies for the domain in browser settings and retry in a private window.
  3. Isolate the layer. Run the request outside the browser with curl using the same headers. If curl succeeds, the browser's headers (usually the cookie or user agent) are the difference. If curl fails with 400, the origin or the WAF parses differently.
  4. Fix the trigger, not the symptom. If a form is broken, the real cause is usually the form sending a field the new API rejects. Load the previous JSON and fix the payload.
  5. Test the proxy path. If Cloudflare returns the 400 edge-side, test an exact URL in low-security or dev mode, or inspect the WAF events for the rejected request.
  6. Regress recent changes. A 400 on forms and login after a deploy almost always traces to a changed validator or middleware.
# Minimal repro from the terminal
curl -i -X POST https://example.com/api/order \
  -H "Content-Type: application/json" \
  -d '{"customer": "Sacha"}'
# Compare expected 2xx vs the exactly failing payload

Verify

Prevention

When to involve a professional

If a correct curl still returns 400 and the CDN is in the path, test a request to the origin directly. If the origin accepts it, the WAF signature is the cause, and the vendor logs will show the exact rejected header.

Need a website built, fixed, optimised, migrated or replaced?

This technical resource is written by CSMBAC, a small design and development studio. If you would rather hand the problem to a professional, the website service page explains how we build enquiry-ready websites.

Explore website services