Web Hosting

Reason and Resolution of HTTP Error 400

Everybody has faced this issue atleast once while browsing the internet The examples are listed below.

  • Error : 400 – Bad request. The request could not be understood by the server due to unacceptable or faulty syntax. It should not be repeated without any modifications.
  • Bad Request – Invalid URL
  • Bad Request. Server couldn’t understand request sent by the browser.
  • HTTP Error 400. The request hostname is invalid
  • Bad Request: Error 400
  • HTTP Error 400 – Bad Request

So let’s know what does the Error-400 means, how can we resolve this.

What is Error-400?

This issue mostly related to the client-side requests. It occurs when the request sent by the client is corrupted or having the wrong syntax. 

Reasons : 

There can be many reasons behind the occurrence of the error 400. Below are the main reasons which can cause you to face this issue.

  1. Incorrect URL: It may be possible that you have entered the internet address incorrectly, for e.g: you may have entered some characters which are not acceptable by the server.
  2. Outdated DNS: The issue may be caused by the outdated DNS cache. For e.g: the website has been moved to another server and due to outdated DNS cache the request is still going to its old server.
  3. Outdated Cookies: This issue may occur if the browser cookies are incorrect or outdated.
  4. Uploading Files are too large: If you are trying to upload a file that is too large, the server may refuse to accept them and throw an error “Bad Request”.

If the target web server uses IIS7.0 or advance version then more detailed information can be obtained. For e.g:

  • 400.1: Invalid Destination Header
  • 400.2: Invalid Depth Header
  • 400.3: Invalid If Header
  • 400.4: Invalid Overwrite Header
  • 400.5: Invalid Translate Header
  • 400.6: Invalid Request Body
  • 400.7: Invalid Content-Length
  • 400.8: Invalid Timeout
  • 400.9: Invalid Lock Token

Resolution: Following the below methods we may be able to solve the Error 400.

Method 1: In case of Incorrect URL: If you are typing manually make sure not to make any typing mistakes. If you clicked on a link check the spelling on it or go to the home page and find the desired link from there.

Method 2: Outdated DNS: In this case try to flush the DNS cache of your network. It can be identified if you are able to access the website from a different network.

The command to flush the DNS on windows

Ipconfig /flushdns

The command to flush DNS on MAC

  • OS X 10.4 (Tiger): lookupd -flushcache
  • OS X 10.5 (Leopard): dscacheutil -flushcache
  • OS X 10.6 (Snow Leopard): dscacheutil – flushcache
  • OS X 10.7 (Lion): sudo killall -HUP mDNSResponder
  • OS X 10.8 (Mountain Lion): sudo killall -HUP mDNSResponder
  • OS X 10.9 (Mavericks): dscacheutil -flushcashe; sudo killall -HUP mDNSResponder
  • OS X 10.10 (Yosemite) (10.10.1 – 10.10.3): sudo discoverutil udnsflashcaches
  • OS X 10.10 (Yosemite) (10.10.4+): sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • OS X 10.11 (El Capitan): sudo killall -HUP mDNSResponder
  • macOS 10.12 (Sierra): sudo killall -HUP mDNSResponder

Method 3: In the case of Outdated cookies: Clear the cookies of the browser from which you are trying to access the website.

If clearing cookies doesn’t resolve the issue, try be resetting the browser.

Note: If none of the above mentioned methods resolved the issue, contact the ISP or the website operator. As there may be many other reasons which can cause the issue and can only be found by checking the logs being generated due to the error.