Cloudflare DevelopersCD
Cloudflare Developers9mo ago
8 replies
Nasrin

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:
export default {
  async fetch(request) {
    const destinationURL = "https://www.example.com";
    const statusCode = 301;
    return Response.redirect(destinationURL, statusCode);
  },
};

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 requests from one URL to another or from one set of URLs to another set.
Redirect · Cloudflare Workers docs
Was this page helpful?