Let’s review how this error code works and how you can fix it.
What Is a 400 Bad Request Code?
A 400 bad request error is client-side, meaning something on your end triggered the error. When the server can’t understand a request you’ve made, it returns this error message.
There are many different messages servers use to indicate a 400 error code, including:
- 400 Bad Request
- HTTP 400 Bad Request
- HTTP Status 400 — Bad Request
- 400 Bad Request Error
- HTTP Error 400
- Bad Request: Error 400
- HTTP Error 400 — Bad Request
Note that these messages all describe the same error.
What Causes a 400 Bad Request Response? & How Can You Resolve It?
There are many reasons why your browser might trigger a 400 bad request response. The server or your browser client might not indicate why, so it’s best to troubleshoot for these issues:
Error In The URL String Syntax
If you see this error, it means you mistyped the URL. This is the most common cause of 400 bad requests. You could also have a “malformed URL” or an “illegal” character in the URL string.
A malformed URL is often when an extra percentage sign (%) is included in the URL string. An illegal character is a character that isn’t usually found in an URL (e.g., “}”).
HOW TO FIX IT: Double-check the URL for typos, illegal characters, or remove the double %% characters and try again.
Corrupted or Invalid Cookies
Cookies are information stored on your computer about a site you’ve visited. The next time you visit that website, it will load faster for you by using the data stored by the cookies.
You might receive a bad request error if the cookies you have are old, out of date, or corrupted.
HOW TO FIX IT: You can clear your entire cache or refresh the page for new cookies. Clearing your browser cache means you’ll have to accept new cookies once you revisit the page.
Unsynchronized DNS Cache
Websites use DNS caching to get information about past queries you’ve made online. Your computer keeps a temporary database of the websites you’ve visited, which can influence search results for you.
However, unauthorized IP addresses are added to your DNS cache, or technical glitches can corrupt your DNS cache. If your computer’s hit with a virus, it could affect your DNS cache.
When the DNS data stored locally on your computer does not sync up with the information on the internet, you get the 400 BNad Request error.
HOW TO FIX IT: Flush your DNS cache. Read PSMag's guide here.
File Size Is Too Large
If you’re uploading a file to your website when you receive the 400 Bad Request error message, it can be because the file size is too large and the server rejects it.
HOW TO FIX IT: Try uploading a lower-resolution version of the image. You can also try uploading the image to an alternative cloud storage service if the file size is still too large.
How to Find 4xx Errors on Your Site
If you own or run your website, finding and fixing 4xx errors can help improve your users’ experience. Some error codes are more difficult to find or attribute cause, so you can use site auditing tools to discover which pages on your website are showing these codes.
Recommended reading: A Non-Jargon Guide to HTTP Status Codes
The Site Audit tool can show you if web crawlers encounter any 4xx (client error) or 5xx (server error) status codes. The tool also includes a specific check for permanent redirects (301 and 308), temporary redirects (307), and ambiguous redirects (302), and any outgoing external links that lead to a 403 status code.
Check out our knowledge base for a complete list of issues you can find with the Site Audit.
To get started with the Site Audit tool:
Pull up the Site Audit tool from your project’s dashboard. (If you don’t have a project set up, you’ll need to create one for your website to use the Site Audit tool.)
Configure the audit’s settings with the tool’s setting panels. You can set the audit’s crawl scope and include any disallowed pages. Select Start Site Audit.
When the audit is complete, use the Issues tab to search for pages that have returned a 4xx error.
Conclusion
Error messages signal when something should be addressed or changed.
Knowing what to do when error messages pop up on your web pages is essential and gives users a better browsing experience. Use an auditing tool to find and fix 4xx error messages as soon as you can.
Source: https://www.semrush.com/blog/400-bad-request/
Không có nhận xét nào:
Đăng nhận xét