diff options
| author | TomasBankauskas <tbdizainas@gmail.com> | 2024-10-01 15:12:01 +0300 |
|---|---|---|
| committer | TomasBankauskas <tbdizainas@gmail.com> | 2024-10-01 15:12:01 +0300 |
| commit | 85116eaa91740ed4c93159c871baaff673140106 (patch) | |
| tree | aaf876b4de730cb144a62dc6f8a6d49eed1936d1 /src/components | |
| parent | 6f22fadd4dde3985e25a99cdcd89ad3067bf47d0 (diff) | |
updated EdgeFunctionExplainer.astro
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/EdgeFunctionExplainer.astro | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/components/EdgeFunctionExplainer.astro b/src/components/EdgeFunctionExplainer.astro index fb6e6ae..197730e 100644 --- a/src/components/EdgeFunctionExplainer.astro +++ b/src/components/EdgeFunctionExplainer.astro @@ -5,16 +5,14 @@ const explainer = ` This page is using a Netlify Edge Function (\`netlify/edge-functions/rewrite.js\`) to rewrite the URL based on visitor geography. ~~~js -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; ~~~ [See more examples](https://edge-functions-examples.netlify.app) |
