I would like to set up a redirection for pages

Hello ,
I hope this message finds you well. I am reaching out to request assistance with configuring a specific redirect scenario on my website.

I would like to set up a redirection for pages that encounter a 403 error. Instead of displaying the default 403 error page, I want visitors to be redirected to a different address.

I understand that Page Rules in the Cloudflare dashboard can be used for this purpose. However, I am encountering challenges in achieving the desired redirection specifically for 403 errors.

I would appreciate it if you could provide guidance on the steps to set up this redirection using Cloudflare Page Rules or any other recommended method.

Thank you in advance for your assistance. If you require any additional information, please let me know.

Best regards,

I not believe this is possible.

Page Rules work on requests, and you will only know the status code of the response.

Response values are also not available to Cloudflare Redirects that use the Ruleset Engine.

The best I can think of is to use a custom 403 response HTML page, and include a meta refresh to redirect:

<meta http-equiv="Refresh" content="10; url='https://community.cloudflare.com'" />

Are the 403s coming from your origin or from Cloudflare WAF rules?

1 Like

from origin .

So the origin is displaying a 403 and you want users to be redirected instead of reaching the page with the 403?

If that is the case these will helpful:

with “redirect role” can not set if error status 403 from origin then redirect to url .

HTTP response fields can only be used in certain type of rules. Page Rules and Redirect Rules are not in the list of ‘certain types or rules’.

You could run a worker on all URLs that checks the origin response code, and issues a 30X redirect if the origin response is 403. I think that is a big clunky. (I don’t really get the use case where you are applying access control logic on your origin instead of just doing a redirect in the first place!)