1
2
3
4
5
6
7
8
9
10
11
12
import { fetch } from "https://esm.town/v/std/fetch";
export async function finalUrl(req: Request) {
const url = new URL(req.url).pathname.replace(/^\//, "");
const response = await fetch(url);
return new Response("", {
headers: {
Location: response.url,
},
status: 302,
});
}