From d16622389a114c46d2e1a0e79ea0b4090a0cdca4 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sun, 30 Oct 2022 00:35:13 -0700 Subject: [PATCH] Use client-side redirect --- functions/api.js | 4 ++-- index.html | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/functions/api.js b/functions/api.js index ea6e05e..8ef4a2d 100644 --- a/functions/api.js +++ b/functions/api.js @@ -84,7 +84,7 @@ export async function onRequestGet({ request, env }) { const shortUrl = url.search.substring(1); const fullUrl = await env.links.get(shortUrl); if (fullUrl === null) { - return Response.redirect('https://alu.bz'); + return new Response('https://alu.bz'); } - return Response.redirect(fullUrl); + return new Response(fullUrl); } diff --git a/index.html b/index.html index 6f8750c..3910c32 100644 --- a/index.html +++ b/index.html @@ -67,9 +67,11 @@ -- 2.47.3