Worker is lowercasing URL using Response.redirect

Using this code:
async function redirect(request) {
    const uri = request.url.replace(/^https:\/\/.*?\//gi, "/");
    console.log(uri);
    let url = "https://mirrors.lifehacker101.net/flashcard-archive/" + uri;
    console.log(url);

    return Response.redirect(url);
}


it correctly logs:
/TEST.zip
https://mirrors.lifehacker101.net/flashcard-archive//TEST.zip


However it is doing this instead:
alt-svc: h3=":443"; ma=86400
cf-ray: 8b95d70761e72d54-yvr
connection: keep-alive
content-length: 0
date: mon, 26 aug 2024 18:21:09 gmt
location: https://mirrors.lifehacker101.net/flashcard-archive//test.zip
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=f6ywic6ivn7gxmcc5of0ttz8mshxbgs3x1uxhauebsfxf8pjmihymutle5mil4jijka6g1lz0g9%2fzrm8fk2phzsnmbin3onytxadmywve7vreftyi07xfrair4y8bcv1ande8qvoqlulvu8ai0mmt%2ft8zmc5eryp7ci5lw550doptvwkumzwml%2fwfb9g"}],"group":"cf-nel","max_age":604800}
server: cloudflare
vary: accept-encoding


This causes 404 on the target location's web server.

Is there something going on that I don't know about causing this?
Was this page helpful?