Troubleshooting Cloudflare 5XX errors
When troubleshooting most 5XX
errors, the correct course of action is to first contact your hosting provider or site administrator to troubleshoot and gather data. The following sections outline:
- The information to provide your hosting provider to help resolve the errors
- The steps to access error analytics in the Cloudflare dashboard.
When contacting your hosting provider, share the following information:
- The specific
5XX
error code and message. - The time and timezone when the
5XX
error occurred. - The URL that resulted in the HTTP
5XX
error (for example,https://www.example.com/images/icons/image1.png
).
The cause of the error is not always found in the origin server's error logs. Be sure to check the logs of any load balancers, caches, proxies, or firewalls between Cloudflare and the origin web server.
Additional details to provide to your hosting provider or site administrator can be found in the error descriptions below. Note that Cloudflare Custom Error Pages can alter the appearance of default error pages discussed in this page.
Error analytics per domain are available within Zone Analytics. Error analytics provides insights into overall errors by HTTP error code and offers details such as the URLs, source IP addresses, and Cloudflare data centers needed to diagnose and resolve issues. Error Analytics are based on a 1% traffic sample.
To view Error Analytics:
- Log in to the Cloudflare dashboard ↗.
- Select your account and domain.
- Go to Analytics & Logs.
- Select Add filter, select Edge status code or Origin status code and choose any
5xx
error code that you want to diagnose.
This error indicates a problem with your origin web server, preventing it from fulfilling the request.
The Error establishing database connection message
is a common HTTP 500
error, typically indicating an origin web server issue. If you encounter this error, contact your hosting provider for assistance.
When dealing with most 5XX
errors, the first step is to reach out to your hosting provider or site administrator to help troubleshoot the issue. Share the necessary error details to your hosting provider to assist troubleshooting the issue.
However, if the 500
error contains cloudflare
or cloudflare-nginx
in the HTML response body, contact Cloudflare support and provide the following details:
- Your domain name
- The time and timezone of the
500
error occurrence - The output of
www.example.com/cdn-cgi/trace
from the browser where the500
error was observed (replacewww.example.com
with your actual domain and hostname)
An HTTP 502
or 504
error indicates that Cloudflare is unable to establish contact with your origin web server.
There are two possible causes:
You may also see 504
status codes in logs or analytics caused by cache MISS responses from Early Hints.
To resolve 502/504
errors, it is essential to identify whether the issue originates from your origin web server or Cloudflare. In the following sections, you can find more details for troubleshooting and resolving errors from both sources.
Cloudflare returns a Cloudflare-branded HTTP 502
or 504
error when your origin web server responds with a standard HTTP 502 bad gateway
or 504 gateway timeout
error:

Contact your hosting provider to troubleshoot these common causes at your origin web server:
- Ensure the origin server responds to requests for the hostname and domain within the visitor's URL that generated the
502
or504
error. - Investigate excessive server loads, crashes, or network failures.
- Identify applications or services that timed out or were blocked.
A 502
or a 504
error originating from Cloudflare appears as follows:

If the error does not mention cloudflare
, contact your hosting provider for assistance. Refer to 502/504 errors from your origin for more information.
This error can occur due to a compression issue at the origin, such as when the origin server serves gzip-encoded compressed content but fails to update the content-length
header, or if the origin is serving broken gzip compressed content. To diagnose this, you can try disabling compression at your origin to confirm if it resolves the error.
Additionally, in some cases, a particular data center may experience a sudden increase in traffic. To ensure minimal impact for customers, our automated processes will redirect traffic to another data center. These adjustments typically happen seamlessly and take just a few seconds. However, during this process, some clients may experience temporary latency or HTTP 502
errors. You can find more information about our automated traffic management tools in this blogpost ↗.
If you need further assistance from our Support team, provide the following details to Cloudflare Support to avoid delays in processing your inquiry:
- The time and timezone when the issue occurred.
- The URL that resulted in the HTTP
502
or504
response (for example,https://www.example.com/images/icons/image1.png
). - The output from browsing to
<YOUR_DOMAIN>/cdn-cgi/trace
.
HTTP error 503 occurs when your origin web server is overloaded.
There are two possible causes identifiable by the error message:
- Error does not contain
cloudflare
orcloudflare-nginx
in the HTML response body. In this case, the issue is likely from your origin server. - Error contains
cloudflare
orcloudflare-nginx
in the HTML response body. In this case, the issue may stem from Cloudflare.
Additionally, 503
status codes in logs or analytics may result from unsuccessful prefetches from Speed Brain.
To resolve a 503
error, first determine whether the issue originates from your origin web server or Cloudflare. The following sections provide guidance on troubleshooting both scenarios.
If the error does not contain cloudflare
or cloudflare-nginx
in the HTML response body, contact your hosting provider to verify if they rate limit requests to your origin web server.
If the error contains cloudflare
or cloudflare-nginx
in the HTML response body, a connectivity issue occurred in a Cloudflare data center. Provide Cloudflare support with the following information:
- Your domain name
- The time and timezone of the
503
error occurrence - The output of
www.example.com/cdn-cgi/trace
from the browser where the503
error was observed (replacewww.example.com
with your actual domain and hostname)
This error occurs when the origin server returns an empty, unknown, or unexpected response to Cloudflare.
This error is often triggered by:
- Origin server crashes or misconfigurations.
- Firewalls or security plugins blocking Cloudflare IPs ↗ at your origin.
- Headers exceeding 16 KB (often due to excessive cookies).
- Empty or malformed responses lacking an HTTP status code or response body.
- Missing response headers or origin web server not returning proper HTTP error responses ↗.
- Incorrect HTTP/2 configuration at the origin server.
-
Contact your hosting provider or site administrator and share the necessary error details to assist with troubleshooting. Request a review of your origin web server error logs for crashes and check for common causes mentioned in the previous section.
-
If HTTP/2 is enabled at your origin server, ensure it is correctly set up. Cloudflare connects to servers who announce support of HTTP/2 connections via ALPN ↗. If the origin web server accepts the HTTP/2 connection but then does not respect or support the protocol, an HTTP
520
error will be returned. You can disable the HTTP/2 to Origin in Speed > Optimization > Protocol Optimization on the Cloudflare dashboard. -
If
520
errors continue after contacting your hosting provider or site administrator, provide the following information to Cloudflare Support:- Full URL(s) of the resource requested when the error occurred.
- Cloudflare cf-ray from the
520
error message. - Output from
http://<YOUR_DOMAIN>/cdn-cgi/trace
. - Two HAR files:
- One with Cloudflare enabled on your website.
- Another with Cloudflare temporarily disabled.
Error 521
occurs when the origin web server refuses connections from Cloudflare. Security solutions at your origin may block legitimate connections from certain Cloudflare IP addresses ↗.
The two most common causes of 521
errors are:
- Offlined origin web server application.
- Blocked Cloudflare requests.
Contact your hosting provider or site administrator and share the necessary error details to assist in troubleshooting these common causes:
- Ensure your origin web server is responsive.
- Review origin web server error logs to identify web server application crashes or outages.
- Confirm Cloudflare IP addresses ↗ are not blocked or rate limited.
- Allow all Cloudflare IP ranges ↗ in your origin web server's firewall or other security software.
- Confirm that — if you have your SSL/TLS mode set to Full or Full (Strict) — you have installed a Cloudflare Origin Certificate or a certificate matching the requirements for these modes.
- Find additional troubleshooting information on the Cloudflare Community ↗.
Error 522
occurs when Cloudflare times out contacting the origin web server.
Two different timeouts cause HTTP error 522
depending on when they occur between Cloudflare and the origin web server:
- Before a connection is established, the origin web server does not return a SYN+ACK to Cloudflare within 19 seconds of Cloudflare sending a SYN.
- After a connection is established, the origin web server does not acknowledge (ACK) Cloudflare's resource request within 90 seconds.
-
Contact your hosting provider and share the necessary error details to assist in troubleshooting these common causes:
- Cloudflare IP addresses ↗ are rate limited or blocked in .htaccess, iptables, or firewalls. Confirm your hosting provider allows Cloudflare IP addresses (most common cause).
- An overloaded or offline origin web server drops incoming requests.
- Keepalives ↗ are disabled at the origin web server.
- The origin IP address in your Cloudflare DNS app does not match the IP address currently provisioned to your origin web server by your hosting provider.
- Packets were dropped at your origin web server.
-
If you are using Cloudflare Pages, verify that you have a custom domain set up and that your CNAME record is pointed to your custom Pages domain.
-
If you are using Workers with a Custom Domain, performing a
fetch
to its own hostname will cause a522
error. Consider using a Route or target another hostname instead. -
If none of the above leads to a resolution, request the following information from your hosting provider or site administrator before contacting Cloudflare support:
- An MTR or traceroute from your origin web server to a Cloudflare IP address ↗ that most commonly connected to your origin web server before the issue occurred. Identify a connecting Cloudflare IP recorded in the origin web server logs.
- Details from the hosting provider's investigation, such as pertinent logs or conversations with the hosting provider.
This error occurs when Cloudflare cannot contact your origin web server.
This typically occurs when a network device between Cloudflare and the origin web server does not have a route to the origin's IP address.
Contact your hosting provider and share the necessary error details to exclude the following common causes at your origin web server:
- Confirm the correct origin IP address is listed for A or AAAA records within your Cloudflare DNS app.
- Troubleshoot Internet routing issues between your origin and Cloudflare, or with the origin itself.
If none of the above leads to a resolution, request the following information from your hosting provider or site administrator:
- An MTR or traceroute from your origin web server to a Cloudflare IP address ↗ that most commonly connected to your origin web server before the issue occurred. Identify a connecting Cloudflare IP from the logs of the origin web server.
Error 524
usually indicates that Cloudflare successfully connected to the origin web server, but the origin did not provide an HTTP response before the default 100 seconds Proxy Read Timeout.
This can happen if the origin server is taking too long because it has too much work to do, for example, a large data query, or because the server is struggling for resources and cannot return any data in time.
Error 524
can also indicate that Cloudflare successfully connected to the origin web server to write data, but the write did not complete before the 30 seconds Proxy Write Timeout (or 6.5 seconds in the case of Cloudflare Images).
Here are the options we suggest to work around this issue:
- Implement status polling of large HTTP processes to avoid hitting this error.
- Contact your hosting provider to exclude the following common causes at your origin web server:
- A long-running process on the origin web server.
- An overloaded origin web server.
- Enterprise customers can increase the
524
timeout up to 6,000 seconds using the Edit zone setting endpoint (proxy_read_timeout
setting). If your content can be cached, you may also choose to use a Cache Rule with theProxy Read Timeout
setting selected instead in the Cloudflare Dashboard.
- If you regularly run HTTP requests that take over 100 seconds to complete (for example, large data exports), move those processes behind a subdomain not proxied (grey clouded) in the Cloudflare DNS app.
This error indicates that the SSL handshake between Cloudflare and the origin web server failed.
Error 525
occurs when these two conditions are true:
- The SSL handshake ↗ fails between Cloudflare and the origin web server.
- Full or Full (Strict) SSL is set in the Overview tab of your Cloudflare SSL/TLS app.
Contact your hosting provider to exclude the following common causes at your origin web server:
- No valid SSL certificate is installed.
- Port
443
(or another custom secure port) is not open. - No SNI support.
- The cipher suites used by Cloudflare do not match the cipher suites supported by the origin web server.
-
Verify that a certificate is installed on your origin server. For details on running tests, refer to Troubleshoot requests with curl. If no certificate is installed, you can generate and install a free Cloudflare origin CA certificate to encrypt traffic between Cloudflare and your origin web server.
-
Review the cipher suites used by your server to ensure they are compatible with Cloudflare.
-
Check your server's error logs from the timestamps when
525
errors occur to identify any issues causing the connection to be reset during the SSL handshake.
This error indicates that Cloudflare is unable to verify the SSL certificate on your origin server, preventing a secure connection from being established.
This error occurs when these two conditions are true:
- Cloudflare cannot validate the SSL certificate at your origin web server.
- Full SSL (Strict) SSL is set in the Overview tab of your Cloudflare SSL/TLS app.
When using Cloudflare Gateway, an HTTP Error 526
might be returned in the following cases:
-
An untrusted certificate is presented from the origin to Gateway. Gateway will consider a certificate is untrusted if any of these conditions are true:
- The server certificate issuer is unknown or is not trusted by the service.
- The server certificate is revoked and fails a CRL check.
- There is at least one expired certificate in the certificate chain for the server certificate.
- The common name on the certificate does not match the URL you are trying to reach.
- The common name on the certificate contains invalid characters (such as underscores). Gateway uses BoringSSL ↗ to validate certificates. Chrome's validation logic ↗ allows non-RFC 1305 compliant certificates, which is why the website may load when you turn off WARP.
-
The connection from Gateway to the origin is insecure. Gateway does not trust origins which:
- Only offer insecure cipher suites (such as RC4, RC4-MD5, or 3DES). You can use the SSL Server Test tool ↗ to check which ciphers are supported by the origin.
- Do not support FIPS-compliant ciphers (if you have enabled FIPS compliance mode). In order to load the page, you can either disable FIPS mode or create a Do Not Inspect policy for this host (which has the effect of disabling FIPS compliance for this origin).
- Redirect all HTTPS requests to HTTP.
Workers subrequests to any hostname outside your Cloudflare zone that is not proxied by Cloudflare are always made using the Full (strict) SSL mode, regardless of the Workers zone configuration.
As a result, a valid SSL certificate is required at the origin server.
Request your server administrator or hosting provider to review the origin web server's SSL certificates and verify that:
- Certificate is not expired.
- Certificate is not revoked.
- Certificate is signed by a Certificate Authority ↗ (not self-signed).
- The requested or target domain name and hostname are in the certificate's Common Name or Subject Alternative Name.
- Your origin web server accepts connections over port SSL port
443
. - Temporarily pause Cloudflare and visit https://www.sslshopper.com/ssl-checker.html#hostname=www.example.com ↗ (replace
www.example.com
with your hostname and domain) to verify no issues exists with the origin SSL certificate:

If the origin server uses a self-signed certificate, configure the domain to use Full SSL instead of Full SSL (Strict). Refer to recommended SSL settings for your origin.
This error indicates that Cloudflare is unable to resolve the origin hostname, preventing it from establishing a connection to the origin server.
An HTTP error 530
is returned when Cloudflare is encountering an issue resolving the origin hostname.
In this case the body of the response contains an 1XXX error code.
Refer to the specific 1XXX error for troubleshooting information.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark