Bugged worker's instance after routes changed

Hello, Cloudflare community!

I’ve started discussion of the problem in Help needed with 301 redirects subject, but now I see that problem is beyond page rules, and I need help of support engineer with my worker’s instances.

Problem: I had a worker’s site running on landshaft.estate domain connected to Cloudflare, after a while I had to switch site’s canonical link to cyrillic domain кпландшафт.рф (punnycode xn--80aalwfnl3ar2b.xn--p1ai), so I’ve connected Cyrillic domain to Cloudflare and changed workers routing to new address. Since that moment, I have relevant version of a worker’s site on a new domain and frozen in time version on original domain. Please, help me get rid of a bugged worker’s instance on landshaft.estate : )

If I try to change name on worker instance I see error.
Same when trying to change routing - video on link.

In the end, I’d like to set 301 redirect from landshaft.estate to xn--80aalwfnl3ar2b.xn--p1ai, which should not be a problem once worker is gone. - here was the question from UPD1 quote -

UPD:
I’ve made new worker’s instance by changing name and route in wrangler.toml file, and after that deleted old one.But I still can see old worker’s site instance running on landshaft.estate, although there are no routes listed in Cloudflare site.

HTTP routes for `landshaft.estate` screen

UPD1:

Blockquote
But as smarsh pointed at, page rules (forwarding URL) shouldn’t work on address with worker running, so how can I set http → https and www.domain → https://domain redirects for my worker site?

Thanks to post by seoworks (Redirects using Workers - state of the art - #2 by seoworks), I’ve implemented redirect inside index.js of my workers site.

Simple solution inside handleEvent(event)

const url = new URL(event.request.url)
if (url.protocol !== "https:" || url.host.match(/www/) ) {
return Response.redirect('https://<my-domain>'+url.pathname+url.search+url.hash, 301)
}

1 Like

With a fresh sight and a bit of bravery I’ve solved problem with bugged workers instance by adding new worker at the same address.

New worker just redirects all requests to target domain.

addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
const url = new URL(request.url)
return Response.redirect('https:/<target-domain>'+url.pathname+url.search+url.hash, 301)
}

Doesn’t feel optimal, but it works : )

1 Like