Skip to content
Hosting Operations6 min read

520 Http Status Code: What It Means and How to Fix It

A 520 http status code means the origin server returned an unknown or invalid response. Compare common causes, check your server logs, and follow a clear fix

Written by Abdul AbrorTechnical Hosting Support Engineer
Lines of colorful JavaScript code displayed on a dark screen
On this page

TL;DR — Key takeaways

  • A 520 http status code is a generic upstream error that means the origin server returned an unknown or invalid response.
  • Common causes include origin server downtime, network timeouts, firewall blocks, SSL handshake failures, and misconfigured reverse proxies.
  • Start by checking your server logs, then verify the origin service, network path, firewall rules, and SSL certificate before changing any configuration.
  • Test changes on a staging environment first, keep a working backup, and roll back if the error returns after a risky update.
  • If the error persists across multiple hosts or after basic checks, contact your hosting provider or upstream service with the exact request and error details.

A 520 http status code is one of those errors that stops a visitor mid-request. The browser shows a generic error, and the site owner is left with a log entry and no clear next step.

This guide compares the most common causes, explains how to verify each one, and gives a practical fix path that works for most hosting setups.

What a 520 Http Status Code Actually Means

The 520 error is not a standard HTTP status defined in the original HTTP specification. It is used by many reverse proxies, load balancers, and edge servers to signal that the upstream origin returned an unknown or invalid response.

In plain terms, the proxy received a request, forwarded it to the origin server, and the origin came back with something the proxy could not process. The proxy then returns 520 instead of a normal 502, 503, or 504.

This means the error is usually a symptom of an upstream problem, not a problem with the visitor's browser or your DNS record. The request reached the origin, but the origin did not respond in a usable way.

Common Causes of a 520 Http Status Code

The most frequent cause is an origin server that is down, overloaded, or stuck. If the web server, application process, or database connection pool is exhausted, the origin may return an empty or malformed response.

Network issues also trigger this error. A firewall dropping packets, a routing problem, or a timeout between the proxy and the origin can leave the proxy waiting for a response that never arrives in a valid format.

SSL and TLS problems are another common trigger. An expired certificate, a mismatched hostname, an unsupported protocol version, or a broken certificate chain can cause the origin to reject or fail the handshake, which the proxy reports as 520.

Misconfigured reverse proxies and load balancers can also produce this error. Wrong upstream addresses, incorrect port mappings, missing headers, or a proxy that expects a specific response format can all lead to a 520.

How to Verify the Cause Step by Step

Start by checking your web server and application logs. Look for the exact request that triggered the error, the upstream response code, and any timeout or connection failure messages.

Next, verify that the origin service is actually running. Check the process list, service status, and application logs. A crashed worker, a full disk, or an exhausted memory limit can stop the origin from responding.

Test the connection from a different network or device. If the error disappears on another network, the issue is likely local firewall, DNS, or client-side routing. If it persists everywhere, the problem is on the origin side.

Review firewall rules, security groups, and reverse proxy configuration. Confirm that the proxy can reach the origin on the correct port and that no rule is blocking or dropping the traffic.

Validate the SSL certificate and protocol settings. Check the certificate expiry, chain order, and supported cipher suites. A broken handshake will often surface as a 520 instead of a clearer SSL error.

Tradeoffs Between Quick Fixes and Safe Changes

Restarting the web server or origin service is the fastest way to clear a temporary fault, but it only works if the service is stable and the restart is safe. On a production server, a restart can drop active connections and interrupt users.

Changing firewall rules or proxy settings is often necessary, but it can expose the server to unwanted traffic or break access controls. Test the change on a staging environment first, and keep the current working configuration available for rollback.

Updating SSL certificates or protocol settings is usually safe, but a misconfigured chain or wrong certificate can take the site offline. Always validate the new certificate in a test environment before applying it to production.

The safest path is to verify the root cause first, then apply the smallest possible change. If you must restart a service, do it during a low-traffic window and have a rollback plan ready.

When to Contact Your Hosting Provider

If the error appears on multiple domains or hosts, or if basic checks do not reveal the cause, contact your hosting provider. They can see the origin server, network path, and proxy configuration from the platform side.

Provide the exact request, the error log entry, the timestamp, and the steps you already took. This helps the provider reproduce the issue and avoid asking you to repeat the same checks.

If you manage your own server, keep a backup of your current configuration files before making changes. A rollback is much faster than rebuilding a broken proxy or firewall setup.

Quick troubleshooting checklist

  • Check the web server and origin application logs for the exact request and error message
  • Verify the origin service is running and responding on the expected port and path
  • Test the connection from a different network or device to rule out local firewall or DNS issues
  • Review firewall, security group, and reverse proxy rules for blocked ports or dropped packets
  • Validate SSL certificate validity, chain, and protocol support on the origin server
  • Restart the web server or origin service only after confirming the change is safe and reversible
  • Capture the full request, response headers, and error log entry before and after any fix

FAQ

What does a 520 http status code mean?

A 520 http status code is a generic upstream error that means the origin server returned an unknown or invalid response. The proxy or load balancer received something it could not interpret, so it cannot complete the request.

Why do I see a 520 http status code on my website?

You see a 520 http status code when the origin server fails to produce a valid response. Common triggers include the origin service being down, a network timeout, a firewall blocking the connection, an SSL handshake failure, or a misconfigured reverse proxy.

How do I fix a 520 http status code?

Fix a 520 http status code by checking your server logs first, verifying the origin service is running, testing the network path, reviewing firewall and proxy rules, and validating SSL configuration. Apply changes in a safe order and keep a rollback plan.