Skip to content
HTTP status codes3 min read

400 Bad Request: causes and fixes

400 Bad Request

Short answer

A 400 Bad Request error means the server received a request it could not understand or process because something in it is malformed. The usual culprits are corrupted or oversized cookies, a badly formed URL, or invalid data sent by an app or API client.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. What causes a 400 error
  2. Fixing it as a visitor
  3. Fixing it as the site owner
  4. Prevention
  5. On ArabyHost

With a 400, the server stops at the request before it even looks for the page: something in the URL, headers, cookies or body doesn’t match what it expects. That puts it among the client errors (4xx) in the HTTP status codes, and it is usually fixed on the browser side or in the code that sent the request.

Depending on the server, the message may read 400 Bad Request, Request Header Or Cookie Too Large, or Your browser sent a request that this server could not understand.

What causes a 400 error

  • Corrupted or oversized cookies: some plugins and apps write so many cookies that the request headers exceed what the server accepts.
  • A malformed URL: illegal characters, a % not followed by a valid code, or unencoded spaces.
  • Invalid API data: broken JSON, a missing required field, or a Content-Type header that doesn’t match the body.
  • WordPress admin-ajax.php calls with no registered action; WordPress answers with a 400 and the body 0.
  • A browser extension that rewrites requests or headers, such as some privacy tools.
  • Stale browser cache after the site was changed or moved to a new server.

Fixing it as a visitor

  1. Check the URL and remove anything odd after the ?, then try again.
  2. Open the site in a private (Incognito) window. If it works there, cookies or extensions are the cause.
  3. Clear cookies for this site only: click the padlock next to the address, open site settings, and delete its data.
  4. Temporarily disable extensions, especially ad blockers and privacy tools.
  5. If the error appears on every browser and device, the problem is on the site, so let the owner know.

Fixing it as the site owner

  1. Reproduce the request with curl to see the full response and headers:
curl -i "https://example.com/page?id=10"
  1. Check the logs: in cPanel open Metrics → Errors for recent server errors, and Metrics → Raw Access to see which URLs return 400 and who requests them.
  2. Read the response body from your API: frameworks like Laravel, Express and FastAPI usually name the invalid field there. Make sure you send the right header:
curl -i -X POST https://example.com/api/orders \
  -H "Content-Type: application/json" \
  -d '{"product_id": 15, "qty": 1}'
  1. Cut down cookies: if you see Cookie Too Large, find the plugin or code writing large cookies and keep that data in a server-side session instead.
  2. In WordPress: if the 400 comes from admin-ajax.php or REST routes, disable plugins one at a time to find the one sending incomplete requests. See also WordPress REST API errors.
  3. Encode URLs in your code before sending them, with encodeURIComponent() in JavaScript or urlencode() in PHP.

If the URL itself is extremely long, you may get 414 URI Too Long instead.

Prevention

  • Keep cookies few and small; don’t store large data in them.
  • Validate input in the front end before sending, and return a clear error message instead of an empty response.
  • Test your API endpoints after each release, especially when the request format changes.

On ArabyHost

Your site runs on LiteSpeed, which reads .htaccess just like Apache, and the error log is in cPanel, one click away from the Araby Panel. You can also ask the Araby AI assistant to read the error log and explain the cause and the fix. If a valid request is being rejected by a security rule, support can review the ModSecurity or Imunify360 block for you.

FAQ

Is a 400 error my fault or the website's?

Usually the request itself is the problem: a broken cookie, a mistyped URL or invalid data from an app. It can also be the site's code if it rejects requests that are actually valid.

Why do I get a 400 error on only one website?

Cookies are stored per site. If that site's cookies are corrupted or too large, only that site fails. Clearing that one site's data in your browser usually fixes it.

What's the difference between 400 and 404?

A 400 means the request was invalid, so the server never processed it. A 404 means the request was fine but the page doesn't exist on the server.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.