Skip to main content

Custom Pages

The Custom Pages feature of the Arvancloud CDN lets you set replacement pages or customize various pages of your website, such as error pages and the maintenance page. By default, pages designed by Arvancloud are shown, but you can show visitors a different page by uploading an HTML file or entering a URL of your choice. This helps improve the user experience.

To manage custom page settings, log in to the Arvancloud panel, go to CDN, and select Custom Pages from the side menu.

In this section, you can choose to use the default page or a replacement page separately for error pages and the maintenance page. By selecting Upload HTML, you can upload the HTML file of your own page.

Also, if you want users to be redirected to another page instead of seeing the error or maintenance pages, use the Redirect option.

Finally, after entering the replacement page or address, click Save to apply the settings.

To start building your page, you can use the following custom error template for all pages:

<html>

<head></head>

<body>

#desired variable#

</body>

</html>

Keep in mind that all external resources included in your file, such as images, CSS, and scripts, must be accessible (that is, return a 200 OK response). For example, if the image file you use is on your own domain and you have blocked access from a geographic region for the whole domain, you must customize the path of your static files so that firewall rules are not applied to it, or use Arvancloud Object Storage.

The following table lists the variables you can display on error, maintenance, or DDoS protection pages:

VariableDescription
#IP#Shows the user's IP.
#SID#Shows the ID of the Arvancloud server the user is connected to.
#DOMAIN#Shows the requested domain.
#ERRCODE#Shows the displayed error code (403, 5XX, etc.).
#TIME#Shows the time the error occurred in the format %Y-%m-%d %H:%M:%S %Z.
#REQUEST_ID#Shows the ID of the sent request.
#CHALLENGE#Dynamically loads the DDoS protection challenges.

For example, a 403 error page can use these variables to show the visitor's IP, the domain, the error code, the time, and the request ID.

You can also see implemented examples of error pages at the following address:

https://git.arvancloud.ir/arvancloud/cdn/custom-page-examples

Finally, after uploading your page or entering the replacement address, click Save to apply the settings.

Under Maintenance Page​

With this feature, you can choose which page is shown to your visitors while your website is being updated. In other words, the page your visitors see during a website update can be set in this field.

Note that by setting either of the methods (Upload HTML) or (Redirect), the "Under Maintenance" mode is activated and applied to the entire domain.

Setting a custom page for the under maintenance page via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY ' \

--header 'cache-control: no-cache' \

--form 'file=@"/C:/Users/arvan/Desktop/example.html"' \

--form 'page="under_construction"' \

--form 'type="file"'

Setting a redirect for the under maintenance page via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'page="under_construction"' \

--form 'url="https://example.com/uc.html"' \

--form 'type="url"'

Firewall Errors​

The Arvancloud firewall lets you define security rules in a cloud environment and apply various restrictions to manage access to your content with the highest level of security. You can specify which page is shown to your visitors when firewall errors occur.

By default, Arvancloud's own firewall error page is shown.

Setting a redirect for the firewall error via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'page="firewall_error"' \

--form 'url="https://example.com/firewall"' \

--form 'type="url"'

Setting a custom page for the firewall error via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'file=@"/C:/Users/arvan/Desktop/example.html"' \

--form 'page="firewall_error"' \

--form 'type="file"'

WAF Errors​

WAF is a web application firewall (layer 7 firewall) designed and implemented to monitor or block data packets related to web applications.

By default, Arvancloud's own WAF error page is shown.

Setting a redirect for the WAF error via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'page="waf_protection"' \

--form 'url="https://example.com/waf"' \

--form 'type="url"'

Setting a custom page for the WAF error via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'file=@"/C:/Users/arvan/Desktop/example.html"' \

--form 'page="waf_protection"' \

--form 'type="file"'

SNI and Host Header Domain Mismatch Error​

In this case, the domain specified in the SNI (Server Name Indication) field is active on the Arvancloud CDN, and the domain specified in the Host header is also active on the Arvancloud CDN, but the two domains are not the same. In this case, the Arvancloud CDN responds with the HTTP status code 403 Forbidden. This behavior is designed to prevent CDN Fronting attacks and keep traffic secure.

By default, Arvancloud's own error page is shown for this error.

Unauthorized Domain Request Error​

In this case, the domain specified in the SNI (Server Name Indication) field is active on the Arvancloud CDN, but the domain specified in the Host header is not active on the Arvancloud CDN. In this case, the Arvancloud CDN responds with the HTTP status code 412 Precondition Failed. This response shows that the domain matching precondition was not met.

By default, Arvancloud's own error page is shown for this error.

Rate Limit Errors​

Rate limiting lets you control incoming and outgoing traffic to and from a network. This is done by limiting the number of requests sent by the user.

If a user exceeds the allowed traffic, they see an error page, which by default is Arvancloud's own rate limit error page.

Setting a redirect for the rate limit error via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'page="rate_limit_exceeded"' \

--form 'url="https://example.com/rl"' \

--form 'type="url"'

Setting a custom page for the rate limit error via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'file=@"/C:/Users/arvan/Desktop/example.html"' \

--form 'page="rate_limit_exceeded"' \

--form 'type="file"'

After you enable Secure Link on content, only users who try to access it with their own specially issued encrypted link can access the requested path. These restrictions can be applied based on a specific IP address and access duration.

If the user's identity is not verified based on the request parameters, Arvancloud's default secure link error page is shown.

Setting a redirect for the secure link error via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'page="secure_link_invalid"' \

--form 'url="https://example.com/securelink"' \

--form 'type="url"'

Setting a custom page for the secure link error via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'file=@"/C:/Users/arvan/Desktop/example.html"' \

--form 'page="secure_link_invalid"' \

--form 'type="file"'

Origin Server Connection Errors​

This error message shows that the website's origin server is temporarily unavailable. By default, Arvancloud shows this message when the origin server returns one of the errors 500, 502, 503, or 504.

In this situation, users see Arvancloud's default origin connection error page.

Setting a redirect for origin server connection errors via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'page="error_500"' \

--form 'url="https://example.com/500"' \

--form 'type="url"'

Setting a custom page for origin server connection errors via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/example.com/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: APIKEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'file=@"/C:/Users/arvan/Desktop/example.html"' \

--form 'page="error_500"' \

--form 'type="file"'

DDoS Protection Challenges​

When you enable either the JS or Captcha challenge, a page is shown to your site's visitors to verify that the user is not a bot. With Custom Pages, you can customize these pages.

To design DDoS pages, you must set the %Challenge% variable in the file you upload as the custom page.

JS Challenge​

By default, Arvancloud's own JS challenge page is shown to visitors.

Setting a custom page for the JavaScript challenge via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/arian.run/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: API KEY 1 2 3 4' \

--header 'cache-control: no-cache' \

--form 'file=@"/path/to/file"' \

--form 'page="ddos_js"' \

--form 'type="file"'

Captcha Challenge​

By default, Arvancloud's own Captcha challenge page is shown to visitors.

Setting a custom page for the Captcha challenge via API:

curl --location --request GET 'https://napi.arvancloud.ir/cdn/4.0/domains/arian.run/custom-pages' \

--header 'authority: napi.arvancloud.ir' \

--header 'accept: application/json, text/plain, */*' \

--header 'authorization: API KEY 1 2 3 4' \

--form 'file=@"/path/to/file"' \

--form 'page="ddos_captcha"' \

--form 'type="file"'