Hello, how can I forward url (using page rules) with 200 status code?
Are you talking forward as in redirect?
What use case do you have to redirect with a 2XX code as opposed to a 3XX code?
2XX Codes = “Successful responses”
3XX Codes = “Redirection messages”
4XX Codes = “Client error responses”
5XX Codes = “Server error responses”
You can have a read here:
location.href instead of
location (its the very same!)
Yes I mean redirect, I want to redirect
*.mydomain.com/script.js (for all subdomains) to mydomain.com/script.js with 2XX status code
How is this possible?
Redirection are just possible with 3XX Status Code.
But what you can do:
- change the LINKS in the DOM so they initialy do not begin with
- Set up the PageRule anyway but its not possible with 2XX Code.
The PageRule would look like:
Option 1 (just for
Option 2 (for ALL JS-Files)
Is it possible to redirect the url with 200 status code using cloudflare workers?
It is not possible to redirect with a 200 Code at all, with no technic in this world, as 200 Codes is NO REDIRECT!
I can do this with node.js and express -
but I want to make it for all subdomains using cloudflare
Please show me a example where this kind of redirect is applied I would like to inspect it.
And the documentation is relatively clear that this will send a 302
We are really going a bit in circles I am afraid. As @jb3 and @M4rt1n wrote several times, what you are asking is neither possible nor does it make sense (a redirect is a redirect and content is content).
Yes, you can include the URL in a 200 response, but no remotely sane HTTP client will follow that. Unless you prefer more “feminine” servers
You can’t do that, you need a 3xx redirection code. For a list of 3xx redirection codes visit 3xx Redirection – Cloudflare Help Center
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.