Common 400 errors and what they mean

by | Feb 28, 2020 | Resources

We often get asked about the error messages you might encounter when accessing your website. Here is a quick overview of four common 400 errors!

Hannah Raeside

WHAT IS A 400 ERROR?

The 400 status code, or Bad Request error, means the HTTP request that was sent to the server has invalid syntax.

Here are a few examples of when a 400 Bad Request error might occur:

  • The user’s cookie that is associated with the site is corrupt. Clearing the browser’s cache and cookies could solve this issue
  • Malformed request due to a faulty browser
  • Malformed request due to human error when manually forming HTTP requests (e.g. using curl incorrectly)

WHAT IS A 401 ERROR?

The 401 status code, or an Unauthorized error, means that the user trying to access the resource has not been authenticated or has not been authenticated correctly. This means that the user must provide credentials to be able to view the protected resource.

An example scenario where a 401 Unauthorized error would be returned is if a user tries to access a resource that is protected by HTTP authentication, as in this Nginx tutorial. In this case, the user will receive a 401 response code until they provide a valid username and password (one that exists in the .htpasswd file) to the web server.

WHAT IS A 403 ERROR?

403 errors commonly occur when the user that is running the webserver process does not have sufficient permissions to read the file that is being accessed.

To give an example of troubleshooting a 403 error, assume the following situation:

  • The user is trying to access the web server’s index file, from http://example.com/index.html
  • The web server worker process is owned by the www-data user
  • On the server, the index file is located at /usr/share/nginx/html/index.html

WHAT IS A 404 ERROR?

The 404 status code, or a Not Found error, means that the user is able to communicate with the server but it is unable to locate the requested file or resource.

404 errors can occur in a large variety of situations. If the user is unexpectedly receiving a 404 Not Found error, here are some questions to ask while troubleshooting:

  • Does the link that directed the user to your server resource have a typographical error in it?
  • Did the user type in the wrong URL?
  • Does the file exist in the correct location on the server? Was the resource was moved or deleted on the server?
  • Does the server configuration have the correct document root location?
  • Does the user that owns the web server worker process have privileges to traverse to the directory that the requested file is in? (Hint: directories require read and execute permissions to be accessed)
  • Is the resource being accessed a symbolic link? If so, ensure the web server is configured to follow symbolic links
  • This field is for validation purposes and should be left unchanged.

Pin It on Pinterest