How to Fix Common HTTP Error Codes – Quick Solutions

Every attempt to access an application or web server is accompanied by an HTTP request. Those HTTP requests are responded back with an HTTP status code. These are 3-digit codes which are grouped into five classes.

  • Code starting with 1 stands is Informational.
  • Code starting with 2 indicates – Success.
  • Code starting with 3 implies Redirection.
  • Code starting with 4 indicates – Client Error.
  • And finally, HTTP code starting with 5 means Server Error.

This guide talks about ways to identify and troubleshoot the most common HTTP error codes namely 4XX and 5XX status code errors from system admin’s perspective.

400 Bad Request

This status code tells that an HTTP request has invalid syntax.

Few reasons why this error might occur are –

  • Cookies linked with the site are corrupt. In that case, clearing the cache and the cookies of the browser could fix the issue.
  • Don’t forget to check for errors in the URL which are the most common reason for a 400 bad requests.
  • If it is caused by outdated DNS records, clearing the DNS cache can fix it.

401 Unauthorized

401 status code could mean that the user trying to access the site is not authenticated properly. To view the resource (if protected), the user will need to supply credentials.

A good example would be if the user tried to access a resourced safeguarded by HTTP authentication. The user would continue to see bad response error unless he provided a valid password and username. These credentials are available in the .htpasswd file.

403 Forbidden

403 error message and how it works with a server

This error means that the request was valid but the server failed to process the request due to an absence of permission to access the resources requested. These errors typically occur when the user who is running the server does not have adequate permissions to access the file.

If the user keeps on getting this error, make sure www-data contains proper permissions to access/read the file. What this means is that file’s other permissions should be set to ‘read. The following command should do the trick –

sudo chmod o=r /usr/share/nginx/html/index.html

.htaccess

Sometimes this particular file may also be causing the 403 Forbidden error. This file controls access to resources specific to a certain range of IP addresses. If a user continues to get 403 forbidden error, see if it’s being caused by .htaccess file by changing the required settings should fix the problem.

Missing Index File

The server returns the forbidden error when a user is accessing a directory with no index file and also when the directory listing is not enabled.

To enable the directory listings, you can change the web server configurations.

404 Not Found

This code error is also known as ‘’Not Found’’ error that indicates that the user can communicate with the server, but is failing to locate the requested resource of a file.

This error can occur in several situations such as you are typing an incorrect URL. You are trying to access a page that has been removed from the website. Another reason could be a website has moved to a page without redirecting the URL.

If you’re getting this error try the following methods to fix it.

  • Try refreshing the web page by pressing F5 on your keyboard.
  • Check the typed URL if it contains any error.
  • Clear your browser cache.
  • Change the DNS server. (Try it only when the entire site gives you a 404 error)

500 Internal Server Error

The 500 Internal Server Error is quite common HTTP status code. Usually, it occurs in the situation, when there is something wrong with the website server, but the server is not able to detect the exact problem.

There can be various reason your website is serving this HTTP status code. However, the most common causes for this error could be the crooked .htaccess file, missing package, and plugins conflict.

Quick Solutions

-Check your website’s .htaccess file. Make sure is it is properly structured.

-Check if there is any incorrect permission on files and folders.

502 Bad Gateway

The 502 Bad Gateway or simply 502 status code is another common error, which means that the edge server (The server acts as a proxy) is not able to get a valid response from the upstream server (The origin server). This error can occur because of the reasons like DNS issues, server overload, faulty plugins or themes.

You can try the following things to fix this error.

  • Try reloading the URL by pressing F5 on your keyboard.
  • Begin a new browser session. Close all the opened browser windows and then start a fresh session.
  • Disable your CDN temporarily
  • Try clearing your browser cache.
  • Restart your network equipment.

If you don’t know how to perform above-mentioned fixing methods, read a blog on how to easily fix 502 Bad Gateway error in WordPress.

503 Service Unavailable

The ‘Service Unavailable’ error or 503 status code usually occurs when the server serving your site is under maintenance or overloaded. Most of the time, it is a server-side error, but sometimes there is a chance that your system has some issues causing this error.

Nevertheless, there are few things you can try out to fix it.

  • Refresh/reload the URL by pressing Ctrl+R or F5.
  • Try restarting your router and modem and then your device.

504 Gateway Timeout

504 Gateway timeout

504 status code means the server is a proxy server (gateway server), and it is unable to get a timely response from the backend servers.

  • The following situations may be responsible for it.
  • The connection between server is not good.
  • The server, which is responsible for accomplishing the request is delivering poor performance.
  • The timeout duration for proxy or gateway server is quite short.

Wrapping Up

We hope, now you are aware of the most common HTTP error codes and some quick solutions to those codes as well. If you know any error codes that most often occurs but we did not mention in this guide, feel free to discuss in the following comment section.

STAY UP TO DATE

Sign up today to stay informed with industry news & trends