Worker URL redirect broken, and deletion of worker doesn't do anything?
I'm using a simple URL redirection script to go to another website, so it is easier to share. When on my main browser (Opera) It redirects to example.com, how ever, on other browsers, it properly redirects.
Originally, when putting in the code, I did use https://www.example.com to test, but now, even when deleting that worker and making a new one (same name), it still redirects improperly. Even when deleted, it still redirects, even though it doesn't exist (on the site) anymore.
Here is the code I used:
It's from Cloudflare's developer docs
https://developers.cloudflare.com/workers/examples/redirect/
Edit:
Opening a third browser and checking the URL while deleted does show it's deleted, how ever, in the original 2 browsers, they still redirect to example.com and my own website.
Cloudflare Docs
Redirect · Cloudflare Workers docs
Redirect requests from one URL to another or from one set of URLs to another set.
4 Replies
It's just browser cache. The difference between 301 (perm redirect) and 302 (temp redirect)
In the absense of cache control directives that specify otherwise, a 301 redirect defaults to being cached without any expiry date.
How do I fix it? I tried to change the code to 302, but it still redirects to example.com
Clear your local browser cache, depends on browser on how you do it, but easy to google
that is the danger of 301/perm redirects. It doesn't matter changing it now, because the browser is still caching the 301/perm
unrelated to your issue but if you just want to do a simple redirect though, using Redirect Rules costs you nothing per request unlike Workers: https://developers.cloudflare.com/fundamentals/setup/manage-domains/redirect-domain/
Unless you need the dynamicness of Workers for some reason
I'm using workers because the website I'm redirecting to is hard to remember, so I just wish to use workers as a custom URL that is easier to remember and share.
It's not a lot of people who will be using the redirect every month, so I don't think it will cost anything