Skip to content

Commit 14b4b6c

Browse files
pedrosousaelithrar
authored andcommitted
[Support] Custom Pages: Add note (#17047)
1 parent 813b349 commit 14b4b6c

File tree

1 file changed

+63
-67
lines changed

1 file changed

+63
-67
lines changed

src/content/docs/support/more-dashboard-apps/cloudflare-custom-pages/configuring-custom-pages-error-and-challenge.mdx

Lines changed: 63 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,26 @@
22
pcx_content_type: troubleshooting
33
source: https://support.cloudflare.com/hc/en-us/articles/200172706-Configuring-Custom-Pages-Error-and-Challenge-
44
title: Configuring Custom Pages (Error and Challenge)
5-
65
---
76

8-
## Overview
9-
10-
Cloudflare uses a wide range of [error codes](/support/troubleshooting/cloudflare-errors/) to identify issues in handling request traffic. By default, these error pages mention Cloudflare; however, custom error pages help you provide a consistent brand experience for your users. 
7+
Cloudflare uses a wide range of [error codes](/support/troubleshooting/cloudflare-errors/) to identify issues in handling request traffic. By default, these error pages mention Cloudflare; however, custom error pages help you provide a consistent brand experience for your users.
118

129
If you are on the Pro, Business, or Enterprise plan you can customize and brand these pages for your whole account or for specific domains. You can design custom error pages to appear during a security challenge or when an error occurs.
1310

14-
:::note
11+
:::note[Notes]
12+
13+
- Responses with 500, 501, 503, and 505 HTTP status codes do not trigger custom error pages to avoid breaking specific API endpoints and other web applications.
14+
- Your custom error pages are not used if requests do not contain `accept-encoding` headers. In these cases, Cloudflare will show the standard error pages to website visitors.
1515

16-
500, 501, 503, and 505 responses do not trigger custom error pages to
17-
avoid breaking specific API endpoints and other web applications.
1816
:::
1917

2018
Alternatively, Enterprise customers can customize 5XX error pages at their origin via **Enable Origin Error Pages** in the **Custom Pages** app in the dashboard.
2119

2220
:::note
23-
24-
Enable Origin Error Pages excludes errors 520 to 527.
21+
Enable Origin Error Pages excludes errors 520 to 527.
2522
:::
2623

27-
***
24+
---
2825

2926
## Step 1: Create a custom page
3027

@@ -34,93 +31,92 @@ You can use the following custom error template to start building your page:
3431

3532
```html
3633
<html>
37-
<head></head>
38-
<body>
39-
::[REPLACE WITH CUSTOM ERROR TOKEN NAME]::
40-
</body>
34+
<head></head>
35+
<body>
36+
::[REPLACE WITH CUSTOM ERROR TOKEN NAME]::
37+
</body>
4138
</html>
4239
```
4340

4441
:::caution[Warnings]
4542

43+
- Your custom error page should include a page-specific custom error token if applicable and cannot exceed 1.43 MB. Also, it must include HTML `<head>` and `</head>` tags.
44+
- Make sure that the `referrer` meta tag is not present in your custom error page's HTML code since it will disrupt [Cloudflare challenges](/waf/reference/cloudflare-challenges/): `<meta name="referrer" (...) />`
4645

47-
* Your custom error page should include a page-specific custom error token if applicable and cannot exceed 1.43 MB. Also, it must include HTML `<head>` and `</head>` tags.
48-
* Make sure that the `referrer` meta tag is not present in your custom error page's HTML code since it will disrupt [Cloudflare challenges](/waf/reference/cloudflare-challenges/): `<meta name="referrer" (...) />`
49-
:::
46+
:::
5047

5148
When published, any additional scripts, images, or stylesheets increase the size of your custom error page source by approximately 50%.
5249

5350
### Custom Page example
5451

55-
Here is sample code for a 5XX custom error page without styling: 
52+
Here is sample code for a 5XX custom error page without styling:
5653

5754
```html
58-
<!DOCTYPE html>
55+
<!doctype html>
5956
<html>
60-
<head>
61-
<meta charset="utf-8">
62-
<title>5XX Level Errors page</title>
63-
</head>
64-
<body>
65-
<h1> 5XX Level Errors </h1>
66-
<h2>::CLOUDFLARE_ERROR_500S_BOX::</h2>
67-
</body>
57+
<head>
58+
<meta charset="utf-8" />
59+
<title>5XX Level Errors page</title>
60+
</head>
61+
<body>
62+
<h1>5XX Level Errors</h1>
63+
<h2>::CLOUDFLARE_ERROR_500S_BOX::</h2>
64+
</body>
6865
</html>
6966
```
7067

71-
***
68+
---
7269

7370
## Step 2: Select your custom error tokens
7471

75-
When designing your custom error page, you must include one page-specific custom error token.  Each custom error token provides diagnostic information that appears on the error page. 
72+
When designing your custom error page, you must include one page-specific custom error token.  Each custom error token provides diagnostic information that appears on the error page.
7673

77-
To display a custom page for each error, create a separate page per error. For example, to create a custom error page for both **IP/Country Block** and **Interactive Challenge**, you must design and publish two separate pages. 
74+
To display a custom page for each error, create a separate page per error. For example, to create a custom error page for both **IP/Country Block** and **Interactive Challenge**, you must design and publish two separate pages.
7875

7976
The following tables list each custom error token grouped by the applicable custom error page.
8077

81-
| **Token** | **Available to** |
82-
| -------------- | ---------------- |
83-
| ::CLIENT\_IP:: | All pages |
84-
| ::RAY\_ID:: | All pages |
78+
| Token | Available to |
79+
| --------------- | ------------ |
80+
| `::CLIENT_IP::` | All pages |
81+
| `::RAY_ID::` | All pages |
8582

8683
:::caution
87-
88-
Only one page-specific custom error token can be used per page.
84+
Only one page-specific custom error token can be used per page.
8985
:::
9086

91-
| **Token** | **Available to** |
92-
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
93-
| ::GEO:: | IP/Country Block |
94-
| ::CAPTCHA\_BOX:: | Interactive Challenge<br/>Country Challenge (Managed Challenge)<br/>Managed Challenge / I'm Under Attack Mode (Interstitial Page) |
95-
| ::IM\_UNDER\_ATTACK\_BOX:: | JS Challenge |
96-
| ::CLOUDFLARE\_ERROR\_500S\_BOX:: | 5XX Errors |
97-
| ::CLOUDFLARE\_ERROR\_1000S\_BOX:: | 1XXX Errors |
87+
| Token | Available to |
88+
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
89+
| `::GEO::` | IP/Country Block |
90+
| `::CAPTCHA_BOX::` | Interactive Challenge<br/>Country Challenge (Managed Challenge)<br/>Managed Challenge / I'm Under Attack Mode (Interstitial Page) |
91+
| `::IM_UNDER_ATTACK_BOX::` | JS Challenge |
92+
| `::CLOUDFLARE_ERROR_500S_BOX::` | 5XX Errors |
93+
| `::CLOUDFLARE_ERROR_1000S_BOX::` | 1XXX Errors |
9894

99-
***
95+
---
10096

10197
## Step 3: Style your custom page
10298

103-
Each custom error token has a default look and feel. However, you can use CSS to stylize each custom error tag using each tag's class ID. If you are familiar with CSS styling, you can customize the look and feel of the error page using each tags class ID. Please keep in mind that all the external resources like images, CSS, and scripts will be inlined during the process. As such, all external resources need to be available (i.e. return a 200 OK) otherwise an error will be thrown.
99+
Each custom error token has a default look and feel. However, you can use CSS to stylize each custom error tag using each tag's class ID. If you are familiar with CSS styling, you can customize the look and feel of the error page using each tag's class ID. Please keep in mind that all the external resources like images, CSS, and scripts will be inlined during the process. As such, all external resources need to be available (that is, they must return 200 OK) otherwise an error will be thrown.
104100

105-
***
101+
---
106102

107103
## Step 4: Preview and Publish your custom page
108104

109105
After customizing your custom error page, there are two options for adding the page to Cloudflare:
110106

111-
* Account level: the custom error page will apply to every domain associated with your account.
112-
* Domain level: the custom error page will apply to only one domain associated with your account.
107+
- Account level: the custom error page will apply to every domain associated with your account.
108+
- Domain level: the custom error page will apply to only one domain associated with your account.
113109

114110
:::note
115111

116112
If Cloudflare cannot load your site or you have blocked the United States (US) via [IP Access rules](/waf/tools/ip-access-rules/) or WAF custom rules, publishing and previewing the error page will not work.
117113

118-
A common error might look like the following: `Error fetching page: Fetch failed, https://example.com/ipcountryblock.html returned 403 (Code: 1202)`. Make sure that you are serving the custom error page with an `HTTP 200` status code, and that no WAF rule is blocking or challenging your custom error page.
114+
A common error might look like the following: `Error fetching page: Fetch failed, https://example.com/ipcountryblock.html returned 403 (Code: 1202)`. Make sure that you are serving the custom error page with an `HTTP 200` status code, and that no WAF rule is blocking or challenging your custom error page.
115+
119116
:::
120117

121118
:::note
122-
123-
When publishing the custom error page, the system will ignore query strings. This means that if the custom error page URL contains a query string the address published will remove `?` and anything after that (ie. `https://domain.com/5xx.html?removeimages` -> `https://domain.com/5xx.html`).
119+
When publishing the custom error page, the system will ignore query strings. This means that if the custom error page URL contains a query string the address published will remove `?` and anything after that (for example, `https://domain.com/5xx.html?removeimages` -> `https://domain.com/5xx.html`).
124120
:::
125121

126122
### Account-level custom error page
@@ -149,11 +145,11 @@ To publish a domain level custom error page:
149145

150146
### Update custom error page after publishing
151147

152-
After successfully publishing the custom error page in the **Custom Pages** app, you can remove the page from your origin server. 
148+
After successfully publishing the custom error page in the **Custom Pages** app, you can remove the page from your origin server.
153149

154150
If in the future, you need to update your custom error page, you must re-publish the page at your origin and in the Cloudflare dashboard, even if the page URL remains unchanged.
155151

156-
***
152+
---
157153

158154
## Troubleshoot common custom pages issues
159155

@@ -167,31 +163,31 @@ If you block requests due to a [rate limiting rule](/waf/rate-limiting-rules/) a
167163

168164
If you block countries or IP addresses with a firewall rule (now deprecated), affected visitors will get your **1000 Class Errors page**.
169165

170-
### 1xxx errors
166+
### 1XXX errors
171167

172168
**1XXX Errors** do not customize the following HTTP errors via the Custom Pages app:
173169

174-
* 1001 - Unable to resolve
175-
* 1003 - Bad Host header
176-
* 1018 - Unable to resolve because of ownership lookup failure
177-
* 1023 - Unable to resolve because of feature lookup failure
170+
- 1001 - Unable to resolve
171+
- 1003 - Bad Host header
172+
- 1018 - Unable to resolve because of ownership lookup failure
173+
- 1023 - Unable to resolve because of feature lookup failure
178174

179175
### Custom error page size
180176

181177
Your custom error page cannot be blank and cannot exceed 1.43 MB. To avoid exceeding the custom error page limit, preview your page before publishing to test your page size before publishing.
182178

183179
### General troubleshooting advice
184180

185-
* If you encounter errors while attempting to preview or publish your custom error page, use an [HTML validator](https://validator.w3.org/) to ensure that your code resolves properly. 
186-
* Make sure that you are serving the custom error page with an HTTP 200 status code.
181+
- If you encounter errors while attempting to preview or publish your custom error page, use an [HTML validator](https://validator.w3.org/) to ensure that your code resolves properly.
182+
- Make sure that you are serving the custom error page with an HTTP 200 status code.
187183

188-
***
184+
---
189185

190186
## Related resources
191187

192-
* [WAF custom rules](/waf/custom-rules/)
193-
* [Cloudflare challenges](/waf/reference/cloudflare-challenges/)
194-
* [Troubleshooting Cloudflare errors](/support/troubleshooting/cloudflare-errors/)
195-
* [IP Access rules](/waf/tools/ip-access-rules/)
196-
* [Rate limiting rules](/waf/rate-limiting-rules/)
197-
* [Firewall rules](/firewall/cf-firewall-rules/) (deprecated)
188+
- [WAF custom rules](/waf/custom-rules/)
189+
- [Cloudflare challenges](/waf/reference/cloudflare-challenges/)
190+
- [Troubleshooting Cloudflare errors](/support/troubleshooting/cloudflare-errors/)
191+
- [IP Access rules](/waf/tools/ip-access-rules/)
192+
- [Rate limiting rules](/waf/rate-limiting-rules/)
193+
- [Firewall rules](/firewall/cf-firewall-rules/) (deprecated)

0 commit comments

Comments
 (0)