Computer lessons

Access error "400 Bad request": what is it and how to fix the situation? Debugging on common platforms.

Found in all browsers. In the classical sense, it means that a syntax error is hidden in the request, but in practice, the cause of such an error can be anything: even interruptions in the work of the Internet provider. We have collected here the most common reasons for this error.

What does it mean: Error 400 Bad Request

1. OPERATION OF THE INTERNET PROVIDER

A story from my practice. One day, after downloading the Google Chrome browser, I encountered a problem: when I entered the site’s admin panel, the browser gave error "400 Bad Request"". The same thing happened with the entrance to my other sites. The strange behavior of the browser was that everything was loading - Yandex, any sites, including mine. But it was impossible to go deeper.

USEFUL ABC'S:

400 Bad Request -

literally "bad request"

The version that there was a problem with the hosting disappeared by itself, since all my sites are located on different hosters, and they all gave the same error when logging in. Similar to cookies, because they are the ones that save all passwords and logins. Of course, the first thing that comes to mind in such a situation is that the browser itself is weird. Based on recommendations from experts, and even history for some reason. Just in case. It didn’t help, although this is the first recommendation when you search for ““.
It was decided to tear down the browser itself and reinstall it. Reinstalled. Problem still exists. I thought it wouldn’t hurt to check how things are in other browsers. I loaded the sites into Mozzila Firefox - the same thing. Explorer - again 400 Bad Request. It's clearly not a matter of browsers.

Next, the Firewall was analyzed and corrected: the modem was added to the list of exceptions, and then the Firewall itself was disabled. Does not help. It's the same with antivirus. All settings of the modem, connections and ports were also sanded. I reinstalled the modem several times. In the end, the Internet disappeared completely. Which is to be expected. It’s good that there are restore points - I did a rollback. The Internet appeared, but the problem did not disappear.

I wrote to the support service of one of my hosters: I understand that the problem is not in their area, but suddenly they know how to solve it. While waiting for a response, I contacted my provider - Beeline. It’s already 12 at night, I’ve been busy all day. And I came up with the simplest solution last - the deeper and more valuable the experience. Beeline support service responded: “Currently there are difficulties with GPRS and 3G. We are doing everything we can. We apologize." It was not possible to reach the operator, since apparently there were many people like me that day. I turned off the computer and went to bed. The morning is wiser than the evening.

The next day it disappeared, and the Internet began to fly even faster. It’s interesting that on all the resources I went to using a search query, no one suggested that the problem might lie in the work of the Internet provider. So, if you find such an error, and one of the clearest symptoms of the disease is that the Internet is available, but not everything is loading, don’t worry, but call your provider first. It is possible that you just need to wait a little. But this is only one of the possible reasons.

2. BLOCKING THE ANTI-VIRUS

After some time, I got the same error, but for a completely different reason and with different symptoms. I also couldn’t log into the site’s admin panel, but error 400 Bad Request began to appear when loading other pages and sites, and not always. I immediately ruled out problems with the provider by calling the support service - everything was fine on the line and with the modem. Cleared cookies and cache in a week. And I started working on the antivirus, remembering that the error appeared after the antivirus version was updated the day before.

Whatever antivirus you have, carefully study its settings. If your antivirus has a firewall, you need to look at its settings. The antivirus I have has a firewall, and it’s quite complex. It has a “Rules for Applications” setting. Different antiviruses call this differently, but you usually need to look in this area. Among the listed applications, I found the browser that I work with and increased the level of trust in outgoing and incoming access. It stood very low and blocked the Internet. After which the error disappeared, and the pages began to load quickly.

If one day you

You are already looking at the Internet with different eyes.

From the notes of a neo-blogger

To exclude the antivirus from the list of possible causes, you need to completely disable it for a while, reboot the computer and check the loading of problematic pages with the antivirus disabled. If error 400 disappears, you need to adjust the antivirus program settings or change the antivirus program.

P.S. Since the article is popular, I am adding a postscript. About a week after the above, error 400 appeared again. Not so often, but it popped up periodically. It so happened that I changed the provider - instead of Beeline Megafon, after which the error disappeared completely. If you have tried a lot and nothing has helped, find the opportunity to temporarily try a modem from another provider - in fact, this is the best way to check if the connection is the problem.

3. BLOCKING THE WINDOWS FIREWALL

Firewall is the most common cause of blocked sites and errors 400 Bad Request. To find out it's not in it If this is the case, try disabling it for a while: Start - Control Panel - System and Security - Windows Firewall - Turn it on and off. Then clear the cache and cookies and try loading the problematic pages again.

If the problem was hidden here, then add allowed programs to the firewall. This is done through the Start menu. Start - Control Panel - System and Security - Firewall - Allow a program to run through the firewall. If your browser is not included in the list by default, add it manually. Then turn on the firewall and check how the pages load.

A 400 Bad Request error occurs when the request sent to the site server is incorrect or corrupted and the server receiving the request cannot understand it. Sometimes the problem occurs on the website itself, and you are unlikely to be able to do anything about it. But most of the time the problem is something you can figure out - maybe you typed the address incorrectly, or maybe your browser cache is causing problems. Here are some solutions you can try.

What is a 400 Bad Request error?

The 400 Bad Request error occurs when the server cannot understand the request that has been sent to it. This is called a 400 error because it is the HTTP status code used by the web server to describe such an error.

The 400 Bad Request error can occur due to a simple error in the request. You may have entered the URL incorrectly and for some reason the server is unable to return a 404 error. Or perhaps your web browser is trying to use an expired or invalid cookie. Some servers that are not configured properly may also throw a 400 error instead of more useful errors in some situations. For example, if you try to upload a file that is too large for some sites, you may receive a 400 error instead of an error telling you the maximum file size.

As with 404 and 502 errors, website designers can customize what a 400 error looks like. This way, you may see different 400 error pages on different sites. Websites may also use several different names for this error. For example, you might see things like:

  • 400 Bad Request
  • 400 Bad Request. The request could not be accepted by the server due to incorrect syntax
  • Bad Request - Invalid URL
  • Bad Request. Your browser sent a request that this server could not understand
  • HTTP Error 400: Invalid request hostname
  • Bad Request: error 400
  • HTTP Error 400 - Bad Request

Often you can do something to fix a 400 error, but figuring out what exactly can be difficult due to the vague nature of the error. Here are some things you can try.

Refresh the page

Updating the page is always worth it. Many times the 400 error is temporary and a simple update may help. Most browsers use the F5 key to refresh and also provide a Refresh button somewhere in the address bar. This doesn't often fix the problem, but it only takes a second to complete.

Double check the address

The most common cause of a 400 error is an invalid URL. If you entered the URL into the address bar yourself, you may have made a mistake. If you clicked a link on another web page and received a 404 error, it is also possible that there was a typo in the link. Check the address for any obvious errors. Also, check for special characters in the URL, especially those you don't often see in URLs.

Perform a search

If the URL you are trying to find is descriptive (or if you know the approximate title of the article or page you are expecting), you can use keywords in the address to search the website. In the example below, you can't really tell from the URL itself if something is wrong, but you can see some of the words from the article title.

Armed with this knowledge, you can search the website with relevant keywords. This should take you to the correct page.

This same solution also works if the website you are trying to reach has changed the URL for some reason and has not redirected the old address to the new one.

And if a website doesn't have its own search box, you can always use Google (or any other search engine you prefer). Simply use the "site:" operator to search only the matching site for the keywords.

In the image below, we are using Google and the search phrase "site:local area network site" to search just the site site using keywords.

Clear your browser cookies and cache

Many websites (including Google and YouTube) report a 400 error because the cookies they read are either corrupted or too old. Some browser extensions can also modify your cookies and cause a 400 error. It is also possible that your browser has cached a corrupted version of the page you are trying to open.

To test this feature, you need to clear your browser cache and cookies. Clearing the cache won't affect your browsing experience much, but some websites may take a few extra seconds to load as they re-download all previously cached data. Clearing your cookies means you will have to sign in again to most websites.

Clear your DNS

Your computer may be storing outdated DNS records that are causing errors. Simply clearing your DNS records may help resolve the issue. It's easy to do and won't cause any problems.

Check the file size

If you upload a file to a website and you get a 400 error, then there is a chance that the file is too large. Try uploading a smaller file to confirm if this causes the problem.

Try other sites

If you try to open one website and get a 400 error, try opening other websites to see if the problem persists. If so, it may be a problem with your computer or network equipment and not the website you are trying to open.

Restart your computer and other hardware

This solution is a hit and rebooting your computer and especially your network equipment (routers, modems) is a common way to get rid of many server errors.

Contact website

If you have tried all the solutions and the error does not disappear, it means that the site itself may have problems. Try contacting the website on the contact page (if that works) or through social media. Chances are they are already aware of the problem and are working to fix it.

19.2K

Error 400 (Bad Request) is an HTTP response code , which means that the server was unable to process the request sent by the client due to invalid syntax. These HTTP response codes reflect the complex relationships between the client, the web application, the server, and often several third-party web services at once. This can make it difficult to find the cause of an error, even within a controlled development environment.

In this article we will look at what the 400 Bad Request error means (translated as “Invalid request”) and how to fix it

Server side or client side?

All HTTP response codes in the 4xx category are considered client-side errors. Despite this, the appearance of a 4xx error does not necessarily mean that the problem has anything to do with the client, which refers to the web browser or device used to access the application. Often, if you are trying to diagnose a problem with your application, you can immediately ignore most of the client code and components such as HTML, Cascading Style Sheets ( CSS), client-side JavaScript code, etc. This also applies to more than just websites. Many smartphone apps that have a modern user interface are web apps.

On the other hand, a 400 Bad Request error means that the request sent by the client was incorrect for one reason or another. The user client may try to download a file that is too large, the request may be malformed, the HTTP request headers may be incorrect, and so on.

We'll look at some of these scenarios ( and potential solutions) below. But keep in mind: we cannot definitively rule out either the client or the server as the source of the problem. In these cases, the server is the network entity that generates the 400 Bad Request error and returns it as an HTTP response code to the client, but it is possible that the client is responsible for causing the problem.

Start with a thorough application backup

It is important to make a complete backup of your application, database, etc. before making any edits or changes to the system. Even better, it is possible to create a full copy of the application on an additional intermediate server that is not publicly accessible.

This approach will provide a clean testbed in which you can try out all possible scenarios and potential changes to fix an issue without compromising the security or integrity of your live application.

Diagnosis of error 400 Bad Request

Error 400 Bad Request means that the server ( remote computer) cannot process a request sent by the client (browser) due to a problem that the server interprets as a client-side problem.

There are many scenarios in which a 400 Bad Request error can appear in an application. Below are some of the most likely cases:

  • The client accidentally (or intentionally) sends information that is intercepted by the false request router. Some web applications look for special HTTP headers to process requests and ensure that the client is not doing anything malicious. If the expected HTTP header is not found or is incorrect, then a 400 Bad Request error is a possible result.
  • The client may be uploading a file that is too large. Most servers or applications have a limit on the size of the downloaded file. This prevents clogging of the channel and other server resources. In many cases, the server will issue a 400 Bad Request error when the file is too large and therefore the request cannot be completed.
  • The client is requesting an invalid URL. If a client sends a request to an invalid URL ( incorrectly composed), this may result in a 400 Bad Request error.
  • The client is using invalid or outdated cookies. This is possible because the local cookie in the browser is a session identifier. If a particular session token matches a request token from another client, then the server/application may interpret this as a malicious act and issue a 400 Bad Request error code.

Fixing client side issues

Error 400 Bad Request ( try later) it's better to start with a fix on the client side. Here are some tips to try on the browser or device that's giving you the error.

Check the requested URL

The most common cause of the 400 Bad Request error is simply entering an incorrect URL. Domain names ( for example, website) are case-insensitive, so a mixed-case reference like this works the same as the normal lowercase version. But the parts of the URL that come after the domain name are case sensitive. Unless the application/server specifically pre-processes all URLs and converts them to lowercase before executing the request.

It is important to check the URL for inappropriate special characters that should not be there. If the server receives an invalid URL, it will respond with a 400 Bad Request error.

Clear relevant cookies

One potential cause of a 400 Bad Request error is invalid or duplicate local cookies. HTTP cookies are small pieces of data stored on the local device that are used by sites and web applications to “remember” a specific browser or device. Most modern web applications use cookies to store browser- or user-specific data, identifying the customer and making future visits faster and easier.

But cookies that store session information about your account or device may conflict with another session token from another user, giving one (or both of you) a 400 Bad Request error.

In most cases, it is sufficient to only consider your application for the cookies that are specific to the site or web application that is throwing the 400 Bad Request error.

Cookies are stored based on the domain name of the web application, so you can delete only those cookies that match the site's domain, leaving other cookies intact. But if you're not familiar with manually deleting specific cookies, it's much easier and safer to clear all cookies at once.

This can be done in different ways depending on the browser you are using:

  • Google Chrome;
  • Internet Explorer;
  • Microsoft Edge;
  • Mozilla Firefox;
  • Safari.

Upload a smaller file

If you receive a 400 Bad Request error when downloading a file, try it out on a smaller file. This includes "downloads" of files that won't download from your local computer. Even files sent from other computers count as "uploads" from the perspective of the web server running your application.

Sign out and sign in

Try logging out and logging back in. If you have recently cleared your browser cookies, this will automatically log you out the next time you load the page. Just try logging back in to see if the system works correctly.

Also, the application may encounter an issue related to your previous session, which is just a string that the server sends to the client to identify the client on future requests. As with other data, the session token ( or session string) is stored locally on your device in cookies and is transmitted by the client to the server with each request. If the server decides that the session token is invalid or compromised, you may receive a 400 Bad Request error.

In most web applications, logging out and logging back in causes the local session token to be regenerated.

Debugging on common platforms

If you are using common software packages on your server that generate a 400 Bad Request error, examine the stability and functionality of these platforms. The most common content management systems such as WordPress, Joomla! and Drupal, are well tested in their basic versions. But once you start changing the PHP extensions they use, it's very easy to cause unexpected problems that result in a 400 Bad Request error.

Rollback recent changes

If you updated your content management system just before the 400 Bad Request error appeared, consider rolling back to the previous version that was installed as the fastest and easiest way remove the 400 bad request error.

Likewise, any extensions or modules that have been updated may cause errors on the server side, so rolling back to previous versions of those extensions may also help.

But in some cases, CMSs do not provide the ability to roll back to previous versions. This usually happens with popular platforms, so don't be afraid if you can't find an easy way to go back to using an older version of a particular software platform.

Remove new extensions, modules or plugins

Depending on the specific CMS that the application uses, the names of these components will vary. But in all systems they serve the same purpose: improving the capabilities of the platform relative to its standard functionality.

However, keep in mind that extensions can somehow gain full control over the system, making changes to the PHP, HTML, CSS, JavaScript or database code. Therefore, a wise decision may be to remove any new extensions that have been recently added.

Check for unintentional changes to the database

Even if you deleted an extension through the CMS control panel, this does not guarantee that the changes it made were completely undone. This applies to many WordPress extensions that are given full access to the database.

An extension can change records in the database that do not "belong" to it, but are created and managed by other extensions ( or even the CMS itself). In such cases, the module may not know how to roll back changes made to database records.

I have personally encountered such cases several times. Therefore, the best way is to open the database and manually view the tables and records that may have been modified by the extension.

Finding problems on the server side

If you are sure that the 400 Bad Request error is not related to the CMS, here are some additional tips that may help you find the problem on the server side.

Checking for invalid HTTP headers

The error you receive from the application is the result of missing or incorrect special HTTP headers that the application or server expects to receive. In such cases, you need to analyze the HTTP headers that are sent to the server side.

Almost any web application will log on the server side. They represent the history of what the application did. For example, what pages were requested, what servers it accessed, what results were provided from the database, etc.

Server logs refer to the hardware on which the application is running, and often provide details about the status of connected services or even about the server itself. Search on the Internet “ logs [PLATFORM_NAME]” if you are using a CMS, or “ logs [PROGRAMMING_LANGUAGE]" And " logs [OPERATING_SYSTEM]”, if you have your own application, to get detailed information on searching for logs.

Debug application code or scripts

If this doesn't help, the problem may be in the source code that runs inside the application. Try to diagnose where the problem might be coming from by debugging the application manually and looking at the application and server logs in parallel.

Create a copy of the entire application on your local development device and step through the scenario that caused the 400 Bad Request error. And then review the application code the moment something goes wrong.

Regardless of the reason for the error, even if you were able to fix it this time, the appearance of such an issue in your application is a signal to implement an error handling tool that will help you automatically detect and alert them when they occur.

This publication is a translation of the article “ 400 Bad Request Error What It Is and How to Fix It", prepared by the friendly project team

Internet surfers very often encounter the problem that instead of the intended page, when opening a resource in a web browser, a 400 error containing a description of the incorrect request is displayed. It is believed that this failure is classified as a user failure, and is associated with errors in entering the address of the requested resource, but this is not always the case.

Error 400 (Bad Request) - what is it?

Initially, the error itself can be interpreted precisely as an incorrect request, when an Internet surfer enters an incorrect resource address. This is a so-called syntax error. For example, when trying to access the Mail.Ru mail server, a Ukrainian user can easily enter the domain UA instead of RU, rightly believing that initially the site can redirect depending on the region or location of the user.

But such a domain actually does not exist. So it turns out that instead of entering the start page, the surfer receives a message that a 400 error has occurred (Bad Request - incorrect, incorrect or bad request).

Impact of Windows Services

One of the reasons for the failure, as some experts note, may even be the influence of the services provided by anti-virus software and the security systems of the Windows operating system itself.

The same firewall (firewall) or Windows Defender can easily provoke a situation where error 400 appears. In this case, we are talking about blocking sites and their content. To eliminate this problem, in the simplest case, you should add the address of the Internet resource to the list of exceptions of all security programs. In the case of a built-in firewall, you will have to create a new rule.

Error code 400: Nginx

Often the appearance of an error message is accompanied by an indication of blocking by the Nginx service. There can be two situations: either it is a virus, or the original component actually worked, which, however, is used exclusively in UNIX-like systems, and by and large should have nothing to do with Windows.

The trouble is that in this case a request is made to the server, which is running such an OS, which can block requests made from a specific IP address. In turn, the address itself is marked as unreliable and entered into a special firewall LOG file, which should prevent further attempts to access it. The message that a 400 error has occurred may directly indicate that the system contains a huge amount of computer garbage in the form of caches and Cookies. All this needs to be cleaned.

What to do first?

In all cases when error 400 occurs, first in the browser or using system tools (if by default the Internet is accessed through built-in tools like Internet Explorer or Edge), clear your browsing history, delete cache and cookies. By the way, you can use exclusion lists only after complete cleaning.

Doing this manually is a thankless task, so to simplify the work you should give preference to automatic optimizer programs (Glary Utilities, Advanced System Care, CCleaner, etc.).

On the other hand, it is worth checking the system for various types of adware or spyware, using not an anti-virus scanner, but portable versions of applications like Anti-Malware.

Sometimes even a simple computer restart can help. It is possible that this error was caused by a short-term glitch in the operating system or the default browser (it is very possible that when accessing the requested page in another browser, the error will not appear). In general, the bulk of the work to fix the problem comes down to freeing up system resources and browser memory. After this, the problem disappears in almost all cases, except for the lack of connection or low Internet connection speed, when a timeout may occur - the server waits for a response to a request. But this is another question, although the solutions proposed for this situation also help in other cases when the problem is related to requests in browsers.

For those who do not want to deal with the problem on their own, a special Fix It utility from Microsoft has been created, which can correct some Internet connection errors (and not only). So you shouldn’t neglect such a tool either. In some cases, it can be an effective means of eliminating failures of this kind.

Who among those who like to surf the Internet has not encountered the “400: Bad request” error appearing in the browser? True, not all surfers know what it means and why it occurs. Now we will try to clarify this situation.

400 Bad request: what does this error mean?

As is believed in the computer world, error number 400 is purely user-related when entering an incorrect request (URL) to access a specific site on the World Wide Web. We beg to differ.

Of course, you can enter an incorrect address, but sometimes even when the address or link is opened correctly, the “HTTP: 400 Bad request” error appears again and again. There can be many reasons for this. This is especially often evident when accessing personal hosting services hosted on different, independent servers from different providers. What is the reason?

Request syntax errors

Indeed, one of the root causes can be called a violation of the correct entry of the page address. Let’s take a simple example: when trying to access the same mail server Mail.ru, a Ukrainian user can enter a URL in the address bar that seems to correspond to his region (in this case, let’s say it is the mail.ua address).

In reality, such a site with a postal service does not exist in nature. It is clear that any Internet browser will immediately display the message “400: Bad request”. But even with this formulation of the question, you can find a bunch of other reasons for the access error.

"400: Bad request Nginx" error problem

The Nginx system itself is either a specific proxy mail server or a web server running under UNIX systems.

Typically, errors of this kind are associated with an incorrect server response for a request from a specific IP address. The error results are recorded in a special LOG file, after which they are automatically entered into the firewall as unreliable. Thus, hosting operations are disrupted, regardless of what operating system or browser is used in this situation.

Firewall Impact

As is already clear, the “400: Bad request” error often occurs when a firewall blocks a request.

A way out of this situation may be to add the site address or access device to the list of exceptions. For Windows systems, this is done by accessing the security menu located in the standard “Control Panel”.

In principle, there is nothing wrong even with disabling the firewall completely (of course, if you have a powerful antivirus package). Some clarifications also need to be given on this score.

Antivirus exclusion list

As a rule, the most common standard antivirus packages have their own built-in firewall. It can also block potentially unsafe or unwanted content.