From 6f22fadd4dde3985e25a99cdcd89ad3067bf47d0 Mon Sep 17 00:00:00 2001 From: Lukas Holzer Date: Tue, 1 Oct 2024 10:45:36 +0200 Subject: fix: the redirect in the netlify edge function --- netlify/edge-functions/rewrite.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'netlify') diff --git a/netlify/edge-functions/rewrite.js b/netlify/edge-functions/rewrite.js index 5f216f3..7a56a7f 100644 --- a/netlify/edge-functions/rewrite.js +++ b/netlify/edge-functions/rewrite.js @@ -1,10 +1,8 @@ -const rewrite = async (request, context) => { +export default async (request, context) => { const path = context.geo?.country?.code === 'AU' ? '/edge/australia' : '/edge/not-australia'; - return new URL(path, request.url); + return Response.redirect(new URL(path, request.url)); }; export const config = { path: '/edge' }; - -export default rewrite; -- cgit v1.2.3