DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for 8 Common HTTP Error Codes and Their Possible Fixes
Jollen Moyani for Syncfusion, Inc.

Posted on • Originally published at syncfusion.com on

8 Common HTTP Error Codes and Their Possible Fixes

Hypertext Transfer Protocol (HTTP) is a client-server (web browser-web server) protocol for transmitting the information. The information sent to the server from the client is defined as requests, and the information transmitted from the server to the client is defined as responses.

The response received at the client end is in the form of a three-digit integer called a status code. These status codes are divided into five distinct categories based on the first digit:

  • 1XX Informational responses
  • 2XX Successful responses
  • 3XX Redirection messages
  • 4XX Client error responses
  • 5XX Server error responses

In this blog, we will see the most common client error (4xx) and server error (5xx) responses and their possible fixes.

400 Bad Request

A bad request error code will be sent by the server when the request from the client is invalid or not understandable by the server.

The cause of the 400 error will be:

  • An invalid or mistyped web address.
  • The use of an expired or invalid cookie.
  • A file uploaded on a site that exceeds the maximum file-size limit.

We can fix this issue by:

  • Checking whether the entered URL exists.
  • Clearing the DNS cache.
  • Clearing the browser cookies and cache.
  • Trying to compress the original file and upload a smaller file.

401 Unauthorized

We will receive an unauthorized error code when the server requires authorized credentials from the client to access the requested resource.

The 401 error will occur due to:

  • An invalid username or password.
  • The client request which has been rejected by the server.
  • The client which has been restricted by the server.

The possible fixes for this issue are:

  • Check for invalid characters in the URL and remove them.
  • Check for and use a valid username and password.
  • Clear the DNS cache.
  • Clear the browser cookies.
  • Log out and log in again.

403 Forbidden

The forbidden error code will be received when the server fails to process a valid request sent by a known client, as permission to access the resource has been restricted for the client.

The 403 error will occur due to the following:

  • Content in the resource has been set as private.
  • The client has been restricted from accessing the content.
  • Content can be accessed only from a specific geographic location.
  • IP address has been prohibited.

The possible fixes for the issue are:

  • Check and retype the URL.
  • Clear the browser cookies and cache.
  • Try again after some time: it might be that the website is processing an update.
  • Check with other people to see whether they are experiencing the error, and if so, contact the service or organization directly.
  • Lastly, contact the internet service provider.

404 Not Found

The not found error code will be received when the server cannot find the resource, or its representation, requested by the client or when the server tries to hide the presence of the resource from an unauthorized client.

The causes for the 404 error are:

  • The resource having been removed from the site.
  • The resource URL being changed, and redirection is not properly performed.
  • The client providing an improper URL address.
  • The domain is not existing.

The possible fixes for this issue are:

  • Refreshing the page.
  • Checking and retyping the URL.
  • Searching for the page on a popular search engine.
  • Clearing the browser cache.
  • Changing the DNS server.
  • Moving up one directory level until you find something working.

500 Internal Server Error

We will receive an internal server error code when the server does not know how to manage a situation.

The 500 internal server error will occur due to the following causes:

  • Exceeded file size on the website.
  • Exceeded PHP memory limit or incorrect PHP version.
  • Permission errors for files and folders.
  • Syntax errors in the .htaccess file or corrupted .htaccess file.
  • A problem with third-party plugins or themes.
  • Temporary connection issues.

The possible fixes for this issue are:

  • Refreshing the page.
  • Clearing the browser cache and cookies.
  • Loading the page with a different network.
  • Resetting permissions for files and folders.
  • Updating the PHP version.
  • Regenerating the .htaccess file or correcting errors in the .htaccess file.
  • Disabling the third-party plugins.

502 Bad Gateway

A bad gateway error code will be received when the server receives an invalid response from another server while working as a gateway or proxy.

The bad gateway error occurs due to the following:

  • Server migration.
  • Connectivity issues or high traffic in the server.
  • The server is under routine maintenance.
  • Firewalls blocking the transmission of safe content by mistake.

The possible fixes for this issue are:

  • Refreshing the page.
  • Trying to access the site with a different browser.
  • Clearing browser cache and cookies.
  • Changing the DNS server.
  • Restart networking equipment like routers and the modem.

503 Service Unavailable

A service unavailable error code will be received when the server cannot process a request temporarily because it is under maintenance or overloaded.

The service unavailable error will be due to the following:

  • Server maintenance.
  • Server overload.

The possible fixes for this issue are:

  • Restarting the server.
  • Checking the maintenance session schedule.
  • Disabling auto-updates.
  • Checking the firewall configuration.
  • Looking through the server-side logs (both application logs and server logs).
  • Ensuring the server-side code.

504 Gateway Timeout

A gateway timeout error code will be received when the server does not receive a response from another server before timing out while working as a gateway or proxy.

The gateway timeout error will occur due to the following:

  • Connectivity issues.
  • Server changes (moved to different IP addresses).
  • DNS changes running.
  • Mistakes in the firewall configuration.
  • An error in the network connection.
  • The gateway timeout period is less than the process execution period.

The possible fixes for this issue are:

  • Looking at the server connection.
  • Checking any ongoing DNS changes.
  • Checking the firewall configuration.
  • Increasing the gateway timeout period.
  • Looking through the logs and the server-side code.

Conclusion

Thank you for reading this blog, where we learned about frequent HTTP error codes and their possible solutions. Apply these suggested solutions when necessary.

Please let us know if you have any queries in the comments section below. You may also get in touch with us via our support forum, support portal, or feedback portal. We are delighted to assist you!

Syncfusion’s Essential JS 2 is the only suite you will need to build an app. It contains over 65 high-performance, lightweight, modular, and responsive UI components in a single package. Download a free trial to evaluate them today.

Related blogs

Top comments (0)

Top 7 Badge

Earn our Top 7 Badge!

Write a post that gets featured in our weekly "must-reads" and you can earn this badge for your profile. 😎