Skip to content

Commit

Permalink
Test a redirect.js edge function
Browse files Browse the repository at this point in the history
  • Loading branch information
aurindam committed Oct 10, 2024
1 parent 0608dbd commit c611c9b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions releases/netlify/edge-functions/redirect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// netlify/edge-functions/redirect.js

export default async (request, context) => {
let url = new URL(request.url);
url.hostname = "snapshots.slint.dev";
url.pathname.replace("/1.9.0/", "/master/");
const response = await fetch(url.toString());

// Create a new response with the fetched content and set CORS headers
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: {
...response.headers,
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-store",
},
});
};

export const config = { path: "/1.9.0/wasm-interpreter/slint_wasm_interpreter.js" };

0 comments on commit c611c9b

Please sign in to comment.