Worker/redirect rule conflict
Hi there.
The goal: Rewrite URL so that "mydomain.com/asdf" shows what is hosted at "otherdomain.com/asdf". For all other traffic to "mydomain.com" that does not include "/asdf", redirect to "otherdomain.com/otherpage".
The problem: Everything is working correctly, except - if the URL "mydomain.com/asdf" does not include a trailing slash, the page is redirected, but it should be rewritten. If it does include a trailing slash, "mydomain.com/asdf/", then it rewrites correctly.
I've got a worker which rewrites all URLs containing "mydomain.com" and URI path containing "asdf" by fetching "otherdomain.com/asdf". I've also got a redirect rule which redirects all traffic to "mydomain.com" except for "mydomain.com/asdf*". Cloudflare support confirmed that the redirect rule is set up correctly, and sent me here to get the Worker script looked at.
Worker script
Redirect Rule (on mydomain.com)
This is a Static redirect to https://otherdomain.com/otherpage/ with 301 status code.
0 Replies