Quick and Easy Ways to Fix a 400 Bad Request Error

favicon-astra2x.png

The 400 bad request is an HTTP response code sent from a web server that didn’t understand the request sent from your browser.

It isn’t the most descriptive of error codes but the fact it’s an HTTP 4xx code means it’s client side.

That means it’s typically an issue with your browser, computer, phone or whatever device you’re using to access the website.

Don’t worry though, HTTP error 400 is not serious and is more frustrating than service affecting. There are lots of ways to fix it too.

We’re going to walk you through what a 400 bad request error is, what causes it and how to fix it.

We’ll walk you through every step and show you exactly what to do and how to do it.

By the end of this post, you’ll know everything you need to know about this particular error and how to fix it!

Table Of Contents

What Is a 400 Bad Request Error?

Google 404 error example

A 400 bad request error is an HTTP error that occurs when the request sent from your browser is not understood by the web server.

It’s one of a series of HTTP 4xx errors that are known as client errors because they are usually caused by the client (the browser or local device) rather than the hosting server.

There are times when the 400 bad request error isn’t a client error though. That’s typically when you’re uploading a file to a website.

If that’s what you’re doing when the error occurs, we cover how to fix that at the end of the article.

The HTTP 4xx error family includes:

  • 400 Bad Request – The server didn’t understand the request
  • 401 Unauthorized – Required authentication was not provided
  • 402 Payment Required – Not currently in use
  • 403 Forbidden – The browser does not have permission to make that request
  • 404 Not Found – The page you’re looking for does not exist or cannot be found
  • 405 Method Not Allowed – The type of request is not authorized or not supported
  • 406 Not Acceptable – The server cannot provide the data in the requested format
  • 407 Proxy Authentication Required – Request must first be authenticated by a proxy
  • 408 Request Timeout – The server did not receive the request in a timely manner
  • 409 Conflict – The server resources being requested have different versions or multiple copies
  • 410 Gone – The page being requested does not exist and has been manually removed

There are 28 HTTP 4xx codes in all but these are the ones you’ll see most often.

HTTP Status Codes

There are hundreds of HTTP status codes covering almost every eventuality.

They are given numbers to help you quickly identify the potential issue you’re facing and are split into five distinct families.

  • HTTP 1xx – For information only. Initial response to say everything is proceeding as normal.
  • HTTP 2xx – For information only. Confirmation that an HTTP request has been received and accepted.
  • HTTP 3xx – Redirection codes. The browser needs to take extra action such as redirect to another URL to complete the request.
  • HTTP 4xx – Client error codes. Something is wrong with the request from the browser to the web server.
  • HTTP 5xx – Server or network error codes. The server encountered an issue or error preventing it fulfilling the request.

This page at Moz has a fuller explanation of HTTP status codes and what they all mean.

What Causes HTTP 400 Bad Request Errors

We hinted at the most common causes of HTTP error 400 above. It’s mainly a client error, meaning your browser or device.

There are situations where it could be the network or web server corrupting the message before it arrives but client errors make up the vast majority of HTTP 400s.

HTTP error 400 can be caused by:

  1. Incorrect URLs used
  2. Corruption of the message during transit
  3. Data mismatch between browser cache or cookies
  4. Browser extension interacting with HTTP requests
  5. Uploading a file to a website that’s too large

That last is rare but we have personal experience of it when uploading files to WordPress. We’ll cover how to fix it in this guide.

Fixing HTTP 400 Bad Request Errors

Fixing 400 bad request errors is usually a case of troubleshooting your browser or device.

As the error message is pretty vague, it’s usually a case of trial and error when troubleshooting. The following are the steps we would usually take to address the error when it occurs to us.

It begins with the quick and easy fixes before moving into more involved tasks. We walk you through every step of the way though, so you’re in good hands!

Force Refresh the Page

Refreshing the web page is typically the very first thing we do whenever there’s an issue loading a website.

A forced refresh tells the browser to ignore any cached copies of the page it might have and to request a new copy from the server.

It’s quick, easy and can often fix many of the more common issues.

Use one of these key combinations to force a refresh of your browser.

  • Chrome on Windows: Ctrl + F5
  • Chrome on Mac: Command + Shift + R
  • Firefox on Windows: Ctrl + F5
  • Firefox on Mac: Command + Shift + R
  • Safari: Command + Option + R
  • Microsoft Edge: Ctrl + F5

Check the Requested URL

If you’re still seeing error 400, double check the URL you’re using. A typo in the URL is another common cause of the error. Given how many URLs we use per day, it’s very easy mistake to make.

If you typed the URL, take a good look at it to make sure you didn’t make a mistake.

Do the same if you used a favorite, just in case.

Test Other Websites

While HTTP 400 does not usually indicate an issue with your device or browser, we can quickly test that by visiting another website.

By testing another site, you’re validating your browser, DNS, router and the device you’re using.

Load the Astra website or another website and see what happens.

If they load correctly, it’s definitely something affecting that particular URL.

If they don’t load correctly, it could be a wider browser or device issue.

Clear Browser Cookies

Clear browser cache

Cookies are small files that remember when you last visited a website and any pertinent data about that visit.

For example, if you put something in a shopping cart, it may have been recorded in a cookie so it’s there when you return.

Sometimes, cookies can become corrupted, partially overwritten or loaded incorrectly which can cause HTTP 400 errors.

As clearing browser cookies is simple, let’s try that next.

Use one of the following shortcuts to access the cookie page of your browser:

  • Chrome on Windows: Ctrl + Shift + Delete
  • Chrome on Mac: Command + Shift + Delete
  • Firefox on Windows: Ctrl + Shift + Delete
  • Firefox on Mac: Command + Shift + Delete
  • Safari: Settings > Safari > Clear History and Website Data
  • Microsoft Edge: Command + Shift + Delete

Once on the page, delete cookies and cached data and retest the URL you’re trying to reach.

If the page loads, it was a cookie issue causing the HTTP 400 error.

If the page doesn’t load, try the next fix.

Try a Different Browser

Available browsers

If you’re seeing the HTTP error 400, try the URL in a different browser. Unless you have made any changes to the current browser, it shouldn’t make a difference.

We have seen browser issues send invalid HTTP headers to websites before and this is a quick test to see if that’s the cause here.

If the website works in a different browser, troubleshoot the other one. Deactivate browser extensions, reset any preferences and, as a last resort, reinstall the browser.

If the website still doesn’t work, move on to the next fix.

Deactivate Browser Extensions

Chrome installed extensions

Have you added a new browser extension recently? Have you installed a VPN extension? Ad blocker or proxy extension? Anything that can influence web traffic?

While most browser extensions are well coded and do exactly what they say they do, not all are so well made. As they have been known to cause HTTP 400 errors, let’s disable extensions next.

In Chrome:

Settings > More Tools > Extensions > Toggle off all extensions

In Firefox:

Settings > Add-ons and Themes > Toggle off all extensions

In Microsoft Edge:

Settings > Extensions > Toggle off all extensions

In Safari:

Safari > Preferences > Extensions > Toggle off all extensions

Other browsers will likely be a variant of Chrome or Firefox and should use similar methods.

Clear Your DNS Cache

flush dns

DNS, Domain Name System, is what links URLs to the IP addresses of the server hosting the website. If there is a mismatch between what your computer holds in its DNS cache and the actual web server, it can cause HTTP 400 errors.

Any corruption in the DNS cache can also cause these errors. As flushing the cache is easy, let’s try that next.

To flush DNS in Windows, do the following:

  1. Type ‘cmd’ into the Windows search box
  2. Right click the Command Prompt entry in the menu and select Open as Administrator
  3. Type ‘ipconfig /flushdns’ and hit Enter
  4. Retry the website

To flush DNS on Mac, do the following:

  1. Open Terminal
  2. Type ‘dscacheutil -flushcache’ and hit Enter
  3. Retry the website

If the website loads correctly, there is likely a corruption, old data or data mismatch in your DNS cache. You should be able to access the website as normal now.

If it isn’t fixed, your final option is to restart the device.

Restart Device

Restarting your device can fix all kinds of issues. There’s a good reason every IT or network support tech will always ask you if you have rebooted when you talk to them.

A reboot flushes all memory and all cached data held in memory. When the device loads again, it reloads everything it needs from stored files.

This can be enough to fix a multitude of errors, including the HTTP 400 error.

So, go ahead and restart your device and see what happens.

Incorrect File Size

Maximum upload file size WordPress

The final fix stands on its own because it’s a different type of issue than these others.

All the fixes so far are concerned with you not being able to access the website. This fix is relevant if you’re trying to upload a file to a website or web server and see the HTTP 400 bad request error.

The HTTP error 400 can be caused by the file you’re uploading being too large. That’s usually because there’s a file size limit set on the website or server.

This happens if you’re uploading large images, audio or video to a website that exceeds the file size limit. If it’s your own website, there may be a file size limit set by your web host.

The test for this is simple. Find a much smaller file and try to upload it to the website in exactly the same way.

If it works, you’re likely hitting the file size limit and are seeing HTTP error 400. Read this post to learn how to increase the maximum file upload size in WordPress.

Final Thoughts

HTTP error 400 is relatively simple despite the lack of detail in the error itself.

HTTP 4xx usually means client side, your browser, your phone, your computer. Usually that’s all you need to know.

The rest is simply a matter of trial and error and the fixes within this post are usually all you’ll need!

Do you know of any other fixes for error 400? Have any experiences of it you’d like to share? Tell us your thoughts below!

This article was originally published here.

-

Check out our Starter Sites built with #ToolWeLove including Toolset, Elementor Pro, Astra Pro, and Jet Plugins.

 

Share this page
Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on email