Skip to content

Commit

Permalink
Use relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
man-sg committed Oct 31, 2022
1 parent cbc6ce3 commit 480e15d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules

# poi dist
dist

# Local Netlify folder
.netlify
2 changes: 0 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


[[edge_functions]]
path='/*'
function='split-test'
11 changes: 6 additions & 5 deletions netlify/edge-functions/split-test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export default async (request: Request, context: any) => {
/*
//const buckets = JSON.parse(Deno.env.get("AB_TEST_LIST") || "null");
/*
const buckets = [{ url: "https://edge-handler-poc.netlify.app", weight: 0.5 }, { url: "https://deploy-preview-1--edge-handler-poc.netlify.app", weight: 0.5 }]
//If environment variable not set return standard page
if (!buckets || !request) {
Expand Down Expand Up @@ -54,15 +53,17 @@ export default async (request: Request, context: any) => {
});
}
//Generate full proxy url
const url = `${bucket}${requestUrl.pathname}`;
//Set cookie if new bucket has been set
if (!hasBucket) {
context.cookies.delete(cookieName);
context.cookies.set({ name: cookieName, value: bucket });
}*/

} */
//Generate full proxy url
const url = `https://deploy-preview-1--edge-handler-poc.netlify.app`;
const requestUrl = new URL(request.url);
const url = `https://deploy-preview-1--edge-handler-poc.netlify.app${requestUrl.pathname}`;
const proxyResponse = await fetch(url);
return new Response(proxyResponse.body, proxyResponse);
};

0 comments on commit 480e15d

Please sign in to comment.