Skip to content

Commit faaf04f

Browse files
angelampcostaMaddy-Cloudflare
authored andcommitted
Proposal to create different pages for 5XX errors (#22050)
* Proposal to create different pages for 5XX errors * Corrects link
1 parent 68e8569 commit faaf04f

File tree

13 files changed

+511
-406
lines changed

13 files changed

+511
-406
lines changed

src/content/docs/support/troubleshooting/http-status-codes/cloudflare-5xx-errors.mdx

Lines changed: 0 additions & 406 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
pcx_content_type: troubleshooting
3+
title: Error 500
4+
source: null
5+
---
6+
7+
## Error 500: internal server error
8+
9+
This error indicates a problem with your origin web server, preventing it from fulfilling the request.
10+
11+
### Common causes
12+
13+
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.
14+
15+
### Resolution
16+
17+
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](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/#required-error-details-for-hosting-provider) to your hosting provider to assist troubleshooting the issue.
18+
19+
However, if the `500` error contains `cloudflare` or `cloudflare-nginx` in the HTML response body, contact [Cloudflare support](/support/contacting-cloudflare-support/) and provide the following details:
20+
21+
- Your domain name
22+
- The time and timezone of the `500` error occurrence
23+
- The output of `www.example.com/cdn-cgi/trace` from the browser where the `500` error was observed (replace `www.example.com` with your actual domain and hostname)
24+
25+
:::note
26+
27+
If you observe blank or white pages when visiting your website, confirm whether the issue occurs when [temporarily pausing Cloudflare](/fundamentals/setup/manage-domains/pause-cloudflare/) and contact your hosting provider for assistance.
28+
:::
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
pcx_content_type: troubleshooting
3+
title: Error 502 or 504
4+
source: null
5+
---
6+
7+
## Error 502 bad gateway or error 504 gateway timeout
8+
9+
An HTTP `502` or `504` error indicates that Cloudflare is unable to establish contact with your origin web server.
10+
11+
### Common causes
12+
13+
There are two possible causes:
14+
15+
- [`502/504` errors from your origin web server](#502504-from-your-origin-web-server) (most common).
16+
- [`502/504` errors from Cloudflare](#502504-from-cloudflare).
17+
18+
You may also see `504` status codes in logs or analytics caused by [cache MISS responses from Early Hints](/cache/advanced-configuration/early-hints/#emit-early-hints).
19+
20+
### Resolution
21+
22+
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.
23+
24+
#### 502/504 from your origin web server
25+
26+
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:
27+
28+
![Example of a Cloudflare-branded error 502.](~/assets/images/support/image1.png)
29+
30+
Contact your hosting provider to troubleshoot these common causes at your origin web server:
31+
32+
- Ensure the origin server responds to requests for the hostname and domain within the visitor's URL that generated the `502` or `504` error.
33+
- Investigate excessive server loads, crashes, or network failures.
34+
- Identify applications or services that timed out or were blocked.
35+
36+
#### 502/504 from Cloudflare
37+
38+
A `502` or a `504` error originating from Cloudflare appears as follows:
39+
40+
![Example of an unbranded error 502.](~/assets/images/support/image5.png)
41+
42+
If the error does not mention `cloudflare`, contact your hosting provider for assistance. Refer to [502/504 errors from your origin](#502504-from-your-origin-web-server) for more information.
43+
44+
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.
45+
46+
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](https://blog.cloudflare.com/meet-traffic-manager).
47+
48+
If you need further assistance from our Support team, provide the following details to [Cloudflare Support](/support/contacting-cloudflare-support/) to avoid delays in processing your inquiry:
49+
50+
- The time and timezone when the issue occurred.
51+
- The URL that resulted in the HTTP `502` or `504` response (for example, `https://www.example.com/images/icons/image1.png`).
52+
- The output from browsing to `<YOUR_DOMAIN>/cdn-cgi/trace`.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
pcx_content_type: troubleshooting
3+
title: Error 503
4+
source: null
5+
---
6+
7+
## Error 503: service temporarily unavailable
8+
9+
HTTP error 503 occurs when your origin web server is overloaded.
10+
11+
### Common causes
12+
13+
There are different causes identifiable by the error message or the location of the error:
14+
15+
- Error does not contain `cloudflare` or `cloudflare-nginx` in the HTML response body. In this case, the issue is likely from your origin server.
16+
- Error contains `cloudflare` or `cloudflare-nginx` in the HTML response body. In this case, the issue may stem from Cloudflare.
17+
- Error is only visible in logs or analytics.
18+
19+
### Resolution
20+
21+
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.
22+
23+
#### 503 Error without `cloudflare` or `cloudflare-nginx`
24+
25+
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.
26+
27+
#### 503 Error with `cloudflare` or `cloudflare-nginx`
28+
29+
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](/support/contacting-cloudflare-support/) with the following information:
30+
31+
- Your domain name
32+
- The time and timezone of the `503` error occurrence
33+
- The output of `www.example.com/cdn-cgi/trace` from the browser where the `503` error was observed (replace `www.example.com` with your actual domain and hostname)
34+
35+
#### 503 Error only visible in logs and analytics
36+
37+
These errors result from [unsuccessful prefetches from Speed Brain](/speed/optimization/content/speed-brain/#how-speed-brain-works) and can be discarded. These errors are not visible to visitors of your website. [Speed Brain](/speed/optimization/content/speed-brain/#enable-and-disable-speed-brain) can be disabled for the zone if needed (this feature cannot be disabled for a specific path).
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
pcx_content_type: troubleshooting
3+
title: Error 520
4+
source: null
5+
---
6+
7+
## Error 520: web server returns an unknown error
8+
9+
This error occurs when the origin server returns an empty, unknown, or unexpected response to Cloudflare.
10+
11+
### Common causes
12+
13+
This error is often triggered by:
14+
15+
- Origin server crashes or misconfigurations.
16+
- Firewalls or security plugins blocking [Cloudflare IPs](https://www.cloudflare.com/ips) at your origin.
17+
- Headers exceeding 16 KB (often due to excessive cookies).
18+
- Empty or malformed responses lacking an HTTP status code or response body.
19+
- Missing response headers or origin web server not returning [proper HTTP error responses](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml).
20+
- Incorrect HTTP/2 configuration at the origin server.
21+
22+
:::note
23+
24+
`520` errors are prevalent with certain PHP applications that crash the origin web server.
25+
26+
:::
27+
28+
### Resolution
29+
30+
:::note
31+
32+
As a temporary workaround, you can set the affected DNS record to [DNS-only](/dns/proxy-status/) in the Cloudflare **DNS** app or [temporarily pause Cloudflare](/fundamentals/setup/manage-domains/pause-cloudflare/).
33+
34+
:::
35+
36+
- Contact your hosting provider or site administrator and share the necessary [error details](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/#required-error-details-for-hosting-provider) to assist with troubleshooting. Request a review of your origin web server error logs for crashes and check for [common causes](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-520/#common-causes) mentioned in the previous section.
37+
38+
- 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](https://blog.cloudflare.com/introducing-http2). 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](/speed/optimization/protocol/http2-to-origin/#disable-http2-to-origin) in **Speed** > **Optimization** > **Protocol Optimization** on the Cloudflare dashboard.
39+
40+
- If `520` errors continue after contacting your hosting provider or site administrator, provide the following information to [Cloudflare Support](/support/contacting-cloudflare-support/):
41+
42+
- Full URL(s) of the resource requested when the error occurred.
43+
- Cloudflare **cf-ray** from the `520` error message.
44+
- Output from `http://<YOUR_DOMAIN>/cdn-cgi/trace`.
45+
- Two [HAR files](/support/troubleshooting/general-troubleshooting/gathering-information-for-troubleshooting-sites/#generate-a-har-file):
46+
- One with Cloudflare enabled on your website.
47+
- Another with [Cloudflare temporarily disabled](/fundamentals/setup/manage-domains/pause-cloudflare/).
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
pcx_content_type: troubleshooting
3+
title: Error 521
4+
source: null
5+
---
6+
7+
## Error 521: web server is down
8+
9+
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](https://www.cloudflare.com/ips).
10+
11+
### Common causes
12+
13+
The two most common causes of `521` errors are:
14+
15+
- Offlined origin web server application.
16+
- Blocked Cloudflare requests.
17+
18+
### Resolution
19+
20+
Contact your hosting provider or site administrator and share the necessary [error details](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/#required-error-details-for-hosting-provider) to assist in troubleshooting these common causes:
21+
22+
- Ensure your origin web server is responsive.
23+
- Review origin web server error logs to identify web server application crashes or outages.
24+
- Confirm [Cloudflare IP addresses](https://www.cloudflare.com/ips) are not blocked or rate limited.
25+
- Allow all [Cloudflare IP ranges](https://www.cloudflare.com/ips) in your origin web server's firewall or other security software.
26+
- Confirm that — if you have your **SSL/TLS mode** set to **Full** or **Full (Strict**) — your origin supports HTTPS and/or you have installed a [Cloudflare Origin Certificate](/ssl/origin-configuration/origin-ca) or a certificate matching the [requirements for these modes](/ssl/origin-configuration/ssl-modes/#custom-ssltls).
27+
- Find additional troubleshooting information on the [Cloudflare Community](https://community.cloudflare.com/t/community-tip-fixing-error-521-web-server-is-down/42461).
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
pcx_content_type: troubleshooting
3+
title: Error 522
4+
source: null
5+
---
6+
7+
## Error 522: connection timed out
8+
9+
Error `522` occurs when Cloudflare times out contacting the origin web server.
10+
11+
### Common causes
12+
13+
Two different timeouts cause HTTP error `522` depending on when they occur between Cloudflare and the origin web server:
14+
15+
- 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.
16+
- After a connection is established, the origin web server does not acknowledge (ACK) Cloudflare's resource request within 90 seconds.
17+
18+
### Resolution
19+
20+
- Contact your hosting provider and share the necessary [error details](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/#required-error-details-for-hosting-provider) to assist in troubleshooting these common causes:
21+
22+
- [Cloudflare IP addresses](https://www.cloudflare.com/ips/) are rate limited or blocked in .htaccess, iptables, or firewalls. Confirm your hosting provider allows Cloudflare IP addresses (most common cause).
23+
- An overloaded or offline origin web server drops incoming requests.
24+
- [Keepalives](http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) are disabled at the origin web server.
25+
- 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.
26+
- Packets were dropped at your origin web server.
27+
28+
- If you are using [Cloudflare Pages](/pages/), verify that you have a custom domain set up and that your CNAME record is pointed to your [custom Pages domain](/pages/configuration/custom-domains/#add-a-custom-domain).
29+
30+
- If you are using [Workers with a Custom Domain](/workers/configuration/routing/custom-domains/), performing a `fetch` to its own hostname will cause a `522` error. Consider using a [Route](/workers/configuration/routing/) or target another hostname instead.
31+
32+
- If none of the above leads to a resolution, request the following information from your hosting provider or site administrator before [contacting Cloudflare support](/support/contacting-cloudflare-support/):
33+
34+
- An [MTR or traceroute](/support/troubleshooting/general-troubleshooting/gathering-information-for-troubleshooting-sites/#perform-a-traceroute) from your origin web server to a [Cloudflare IP address](http://www.cloudflare.com/ips) 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.
35+
- Details from the hosting provider's investigation, such as pertinent logs or conversations with the hosting provider.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
pcx_content_type: troubleshooting
3+
title: Error 523
4+
source: null
5+
---
6+
7+
## Error 523: origin is unreachable
8+
9+
This error occurs when Cloudflare cannot contact your origin web server.
10+
11+
### Common causes
12+
13+
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.
14+
15+
### Resolution
16+
17+
Contact your hosting provider and share the necessary [error details](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/#required-error-details-for-hosting-provider) to exclude the following common causes at your origin web server:
18+
19+
- Confirm the correct origin IP address is listed for A or AAAA records within your Cloudflare DNS app.
20+
- Troubleshoot Internet routing issues between your origin and Cloudflare, or with the origin itself.
21+
22+
If none of the above leads to a resolution, request the following information from your hosting provider or site administrator:
23+
24+
- An [MTR or traceroute](/support/troubleshooting/general-troubleshooting/gathering-information-for-troubleshooting-sites/#perform-a-traceroute) from your origin web server to a [Cloudflare IP address](http://www.cloudflare.com/ips) 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.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
pcx_content_type: troubleshooting
3+
title: Error 524
4+
source: null
5+
---
6+
7+
## Error 524: a timeout occurred
8+
9+
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](/fundamentals/reference/connection-limits/).
10+
11+
### Common causes
12+
13+
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.
14+
15+
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](/fundamentals/reference/connection-limits/) (or 6.5 seconds in the case of [Cloudflare Images](/images/)).
16+
17+
:::note
18+
19+
A `524` occurs if the origin web server acknowledges (ACK) the resource request after the connection has been
20+
established, but does not send a timely response.
21+
:::
22+
23+
### Resolution
24+
25+
Here are the options we suggest to work around this issue:
26+
27+
- Implement status polling of large HTTP processes to avoid hitting this error.
28+
- [Contact your hosting provider](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/#required-error-details-for-hosting-provider) to exclude the following common causes at your origin web server:
29+
- A long-running process on the origin web server.
30+
- An overloaded origin web server.
31+
32+
:::note
33+
34+
Logging request response time at your origin web server helps identify the cause of resource slowness. Contact your hosting provider or site administrator for assistance in adjusting log formats or search for related logging documentation for your brand of web server such as [Apache](http://httpd.apache.org/docs/current/mod/mod_log_config.html) or [Nginx](http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format).
35+
:::
36+
37+
- Enterprise customers can increase the `524` timeout up to 6,000 seconds using the [Edit zone setting](/api/resources/zones/subresources/settings/methods/edit/) endpoint (`proxy_read_timeout` setting). If your content can be cached, you may also choose to use a [Cache Rule](/cache/how-to/cache-rules/settings/#proxy-read-timeout-enterprise-only) with the `Proxy Read Timeout` setting selected instead in the Cloudflare Dashboard.
38+
39+
:::note
40+
41+
If the timeouts are on write requests, the [Proxy Write Timeout](/fundamentals/reference/connection-limits/) of 30 seconds cannot be adjusted.
42+
:::
43+
44+
- 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.
45+
46+
:::note
47+
48+
Note that you may observe a 1 second difference between the timeout you have set and the actual time at which the Error `524` is returned. This is expected, it is due to the current work on implementing our proxy - [Pingora](https://blog.cloudflare.com/how-we-built-pingora-the-proxy-that-connects-cloudflare-to-the-internet/).
49+
As a workaround, you can simply set the timeout to one second more (121 seconds instead of 120 seconds, for example).
50+
:::

0 commit comments

Comments
 (0)