Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Common HTTP Errors: Meanings & Fixes

· 7 min read · Home Tech

In this article
  1. How HTTP Status Codes Work
  2. The Most Common 4xx Errors (Client-Side Issues)
  3. The Most Common 5xx Errors (Server-Side Issues)
  4. How to Fix Common HTTP Errors (For Visitors)
  5. How to Fix Common HTTP Errors (For Site Owners)
  6. Less Common But Still Useful Codes
  7. Frequently Asked Questions

HTTP errors are standard status codes a web server sends to tell your browser what happened to a request. This article explains the most common ones you are likely to see, what each code means, and what you can do about them. Whether you are a website visitor or a site owner, understanding these codes helps you diagnose and fix problems faster.

How HTTP Status Codes Work

When your browser asks a server for a page, the server replies with a three-digit status code. The first digit defines the class of the response:

  • 1xx (Informational): The request was received and is being processed.
  • 2xx (Success): The request was received, understood, and accepted. The most common is 200 OK.
  • 3xx (Redirection): Further action is needed to complete the request. The most common is 301 Moved Permanently or 302 Found.
  • 4xx (Client Error): The request contains bad syntax or cannot be fulfilled by the server. This is usually the browser's fault, but it can also be caused by a bad link.
  • 5xx (Server Error): The server failed to fulfill a valid request. This is the server's fault, not yours.

These codes are defined in the HTTP specification (RFC 7231 and related documents). While there are many codes, you will only encounter a handful in everyday browsing.

The Most Common 4xx Errors (Client-Side Issues)

4xx errors mean the problem is on the client side, usually a mistyped URL, a broken link, or a page that has moved. Here are the ones you will see most often:

  • 404 Not Found: The server cannot find the requested resource. This is the most famous error. It happens when a page has been deleted, moved without a redirect, or the URL is typed incorrectly. For example, visiting https://example.com/about-us when the page is actually at https://example.com/about will give a 404.
  • 403 Forbidden: The server understood the request but refuses to authorize it. This often means you do not have permission to access the file or directory. It can also happen if the server's file permissions are set incorrectly (e.g., a directory has no read permission).
  • 400 Bad Request: The server cannot process the request due to a client error, such as malformed syntax or an invalid request message framing. This is less common in normal browsing but can appear if a URL is very long or contains invalid characters.
  • 401 Unauthorized: The request requires user authentication. You will see this when a site requires a login but you have not provided valid credentials. It is often accompanied by a login prompt.
  • 429 Too Many Requests: The user has sent too many requests in a given amount of time. This is a rate-limiting measure to prevent abuse. If you see this, slow down or wait a while before trying again.

If you are a site owner, a 404 can be fixed by setting up a 301 redirect from the old URL to a new one, or by restoring the page. A 403 is often fixed by checking file and directory permissions (e.g., 644 for files, 755 for directories on Linux servers).

The Most Common 5xx Errors (Server-Side Issues)

5xx errors mean the server failed to fulfill a valid request. These are usually temporary and can be fixed by the site owner, not the visitor. Here are the most common:

  • 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request. This is a catch-all for server-side bugs, such as a PHP script that crashed, a misconfigured .htaccess file, or a database connection failure.
  • 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed to fulfill the request. This often happens with reverse proxies (like Nginx) when the backend server (like Apache or a Node.js app) is down or not responding.
  • 503 Service Unavailable: The server is not ready to handle the request, often because it is overloaded or down for maintenance. This is common during high-traffic events or when a site is being updated.
  • 504 Gateway Timeout: The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server. This can happen if a database query takes too long or an external API is slow.

For visitors, the best course of action for a 5xx error is to wait a few minutes and try again. For site owners, check the server logs (e.g., error.log) to see what caused the 500 error; for 502 and 504, check if the backend service is running and healthy.

How to Fix Common HTTP Errors (For Visitors)

If you encounter an HTTP error as a visitor, here are practical steps to resolve it:

  1. Refresh the page: Press F5 or Ctrl+R (Cmd+R on Mac). This sends a new request. For 5xx errors, this often works if the server has recovered.
  2. Check the URL: Look for typos, missing slashes, or extra characters. For a 404, try shortening the URL to the domain root and navigating from there.
  3. Clear your browser cache: A cached version of a page might be causing a 403 or 404. Clear cache and try again.
  4. Try a different browser or incognito mode: This isolates issues caused by extensions, cookies, or cached data.
  5. Wait and retry: For 429, 503, and 504, wait a few minutes and try again. The server may be temporarily overloaded.
  6. Use a search engine: If you get a 404 on a specific page, search for the site name and the topic. The page may have moved to a new URL.

If none of these work, the problem is on the server side, and you cannot fix it from your end.

How to Fix Common HTTP Errors (For Site Owners)

If you run a website, here are common fixes for the errors you might see in your logs:

  • 404: Set up 301 redirects for removed pages, or create a custom 404 page that helps users find what they need.
  • 500: Check the server error log. Common causes are PHP syntax errors, memory limits, or file permissions. If you recently changed a plugin or theme, revert that change.
  • 502/504: Restart your backend services (e.g., PHP-FPM, Node.js). Check if the database is running and responsive. If you use a proxy, ensure the backend URL is correct.
  • 503: This is often intentional during maintenance. If it is not, check if the server is out of memory or if the application is in maintenance mode.

Always check the server's error logs first; they will tell you exactly what went wrong.

Less Common But Still Useful Codes

You may occasionally see these codes:

  • 301 Moved Permanently: The requested resource has been permanently moved to a new URL. Browsers automatically follow this redirect. This is good for SEO because it passes link equity.
  • 302 Found: A temporary redirect. It is often used for temporary maintenance pages or A/B testing.
  • 410 Gone: The resource is no longer available and will not be again. This is a more permanent version of 404.
  • 451 Unavailable For Legal Reasons: The server is denying access due to legal demands. This is rare but used for content blocked by government censorship.

Knowing these helps you understand what a server is trying to tell you, even if you do not see them often.

Frequently Asked Questions

What is the difference between 401 and 403?

401 Unauthorized means you have not authenticated (logged in) or your credentials are invalid. 403 Forbidden means you are authenticated but do not have permission to access the resource. For example, a logged-in user trying to access an admin page might get a 403.

Why do I get a 404 error when the page exists?

This can happen if the URL has a trailing slash issue, if the server has a case-sensitive file system (e.g., Linux), or if the page is actually a different file extension (e.g., .html vs .php). Also, a cached version of the page might be gone while the live version is still there.

Can HTTP errors be a security risk?

Generally, no. Seeing a 404 or 403 is not a security risk. However, a 500 error might reveal sensitive information if the server outputs stack traces. That is why it is important to disable error display in production environments.

How do I check what HTTP status code a website returns?

You can use your browser's developer tools (F12) and go to the Network tab. Reload the page and click on the request; the status code will be shown. Alternatively, you can use command-line tools like curl -I https://example.com to see the headers.

What does '404 Not Found' mean on a website I own?

It means a visitor requested a URL that does not exist on your server. This could be a broken link from another site, a mistyped URL, or a page you deleted without a redirect. You should set up 301 redirects for any deleted pages to avoid losing traffic.