Net Hosting Talk

We are a community of individuals and businesses passionate about web hosting. Let's build, learn, and grow together.

Tutorial Understanding HTTP Status Codes & 4xx & 5xx Server Errors

NhtAdminNhtAdmin is verified member.

NHT Manager
Administrator
When you browse the internet, your browser sends requests to web servers, and each response includes an HTTP status code that shows whether the request was successful or failed. Usually, these codes go unnoticed, pages load normally, and users carry on as usual. But when something goes wrong, the browser displays the error code to help identify what happened.

HTTP status codes are divided into five categories according to their purpose.
  • 1xx — Informational responses
  • 2xx — Successful requests
  • 3xx — Redirects
  • 4xx — Client-side errors
  • 5xx — Server-side errors

HTTP 4xx Status Codes: Client-Side Errors​

A "4xx" error shows that the issue is on the client's side, meaning the browser sent a request the server couldn't process because of a problem with the request itself. This might be a mistyped URL, a missing permission, or trying to access something that no longer exists. Unlike 5xx errors, the server is functioning normally; it just can't handle the request.

Most Common 4xx Errors​

400 — Bad Request. This error shows that the server couldn't understand the request because of invalid syntax. It often occurs when a URL has corrupt or malformed data, or when a form submission contains unexpected characters. Clearing your browser cache and cookies or double-checking the URL usually resolves the problem.

401 — Unauthorized. A 401 error indicates the requested resource needs authentication, and valid credentials haven't been provided. This is common on login-protected pages. If you believe you should have access, double-check your credentials or make sure your session hasn't expired.

403 — Forbidden. Unlike a 401, a 403 error indicates that the server understood the request but is actively refusing to fulfill it, even with valid credentials. This usually happens due to insufficient permissions, IP restrictions, or incorrect file or folder permission settings on the server.

404 — Not Found. The most well-known HTTP error. A 404 indicates that the requested resource doesn't exist on the server, either because the URL was mistyped or because the page has been moved or deleted without a redirect. For website owners, broken links leading to 404 errors can harm both user experience and SEO.

405 — Method Not Allowed. This happens when the HTTP method used in the request (such as GET or POST) isn't supported by the target resource. For example, submitting a form via POST to a URL that only accepts GET requests will cause this error.

408 — Request Timeout. A 408 error indicates that the server waited too long for the client to send a complete request and then stopped waiting. This can occur due to a slow internet connection or network disruptions. Usually, retrying the request fixes the issue.

410 — Gone. Similar to a 404 but more definitive, a 410 means the resource has been permanently removed and will not return. Unlike 404s, search engines will deindex a 410 page more quickly, making it the better choice when deliberately retiring content.

422 — Unprocessable Entity. The server received and understood the request but couldn't process it due to semantic errors, such as a form submission that passes format validation but contains logically invalid data. This is commonly seen in API interactions.

429 — Too Many Requests. This error occurs when a client sends too many requests in a short time, triggering rate limiting on the server. It is commonly seen with APIs or login forms. Waiting a moment before retrying or checking your request rate usually fixes the issue.

Other Notable 4xx Errors​

414 — URI Too Long: The URL sent by the client was too long for the server to handle. This often happens when a browser tries to send too much data with a GET request instead of a POST request.

431 — Request Header Fields Too Large. This error occurs when the HTTP headers in a request exceed the server's size limit. Clearing browser cookies, which are sent as headers, often resolves the issue.

451 — Unavailable For Legal Reasons. This error occurs when access to a resource is restricted for legal reasons, such as government censorship, a court order, or DMCA takedowns. The number 451 references the novel Fahrenheit 451.

HTTP 5xx Status Codes: Server Errors​

A "5xx" error indicates that the server has faced an issue preventing it from fulfilling the request. Unlike 4xx errors, which come from the client side, 5xx errors are entirely server-related. Common causes include misconfigurations, resource shortages, or software malfunctions. The specific error code will point to the source of the problem.

Most Common 5xx Errors​

500 — Internal Server Error. This is a general error indicating that something went wrong on the server, but it couldn't be identified more specifically. It's most often caused by bugs or errors in the website's code. If your site returns a 500 error, check your server's error log for details and start troubleshooting the underlying issue.

502 — Bad Gateway. A server often acts as an intermediary, receiving requests from the browser and forwarding them to a backend service. If these two systems fail to communicate properly (due to a protocol mismatch, a dropped connection, or service overload), a 502 error is returned. This is commonly linked to issues with the hosting provider or an overwhelmed upstream service.

503 — Service Unavailable. This error indicates that the server is temporarily unable to handle requests, usually because it's undergoing maintenance or is overloaded with traffic. If your site shows a 503, contact your hosting provider to verify if scheduled maintenance is in progress. If overload is the issue, you might need to upgrade your hosting plan to prevent future failures.

504 — Gateway Timeout. Error 504 happens when an intermediate server (like a proxy or load balancer) doesn't get a prompt response from an upstream server. This usually indicates slow communication between servers, often because the page is too heavy to load within the given time, or the server is handling too much data. Fixing a 504 usually involves improving your site's content and checking server performance.

Other Notable Server Errors​

505 — HTTP Version Not Supported. This error happens when the browser and server use incompatible versions of the HTTP protocol. Updating the server to support the browser's protocol version will fix the incompatibility, and, as a bonus, keeping your server up to date also improves its security.

507 — Insufficient Storage. When a server runs out of available storage space, it returns a 507 error. The solution is simple: either delete outdated or unnecessary data from the server, or increase its storage capacity.

509 — Bandwidth Limit Exceeded. Some hosting plans have a monthly bandwidth limit. When that limit is reached, the server stops responding to requests until the limit resets or the plan is upgraded. If you're frequently encountering this error, it's a good idea to review your traffic and consider a plan with a higher bandwidth allowance.

Server errors aren't limited to web pages; SMTP server errors can also disrupt email delivery. In all cases, your server's error log is the best starting point for diagnosis. If you're uncertain how to proceed, contact your hosting provider; they can help get your website back online smoothly.
 
  • Advertisement
  • I believe most of the webmasters face 500 error with their website when there is permission issue or .htaccess file is not configured properly .
     
    400 Bad Request.
    401 Unauthorized.
    403 Forbidden.
    404 Not Found.
    500 Internal Server Error.
    502 Bad Gateway.
    503 Service Unavailable.
    504 Gateway Timeout.
     
    1. 400 Bad Request error- It means the HTTP request that was sent to the server has invalid syntax.
    2. 401 Unauthorized- Unauthorized error, means that the user trying to access the resource has not been authenticated or has not been authenticated correctly.
    3. 403 Forbidden- Forbidden error, means that the user made a valid request but the server is refusing to serve the request, due to a lack of permission to access the requested resource.
    4. 404 Not Found- 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.
    5.500 Internal Server Error- The 500 status code, or Internal Server Error, means that server cannot process the request for an unknown reason.
     
    Thank you for laying these common server errors out all in one post! This is a great resource. Thank you to those who commented with more examples of errors. We appreciate you!
     
  • Advertisement
  • Advertisement

    Back
    Top