Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RobFaustLZ committed Sep 1, 2024
1 parent cbe35e8 commit 5cc1789
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "labelzoom-cf-api-proxy",
"version": "1.0.8",
"version": "1.0.9",
"private": true,
"scripts": {
"deploy": "wrangler deploy",
Expand Down
4 changes: 2 additions & 2 deletions src/cors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const corsHeaders = {
"Access-Control-Allow-Methods": "GET,HEAD,POST,PUT,DELETE,OPTIONS",
"Access-Control-Max-Age": "86400",
"Access-Control-Allow-Credentials": "true",
"Access-Control-Expose-Headers": "X-LZ-RequestID",
"Access-Control-Expose-Headers": "X-LZ-Request-ID",
};

/**
Expand Down Expand Up @@ -54,7 +54,7 @@ export function responseWithAllowOrigin(response: Response, origin = '*'): Respo
// Add cache control headers
newResponse.headers.set('Access-Control-Allow-Origin', origin);
newResponse.headers.set('Access-Control-Allow-Credentials', 'true');
newResponse.headers.set('Access-Control-Expose-Headers', 'X-LZ-RequestID');
newResponse.headers.set('Access-Control-Expose-Headers', 'X-LZ-Request-ID');

return newResponse;
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function proxyRequestToBackend(request: Request, url: URL, env: Env, reque
}
newRequest.headers.set('X-LZ-IP', ip);
newRequest.headers.set('X-LZ-Secret-Key', env.LZ_PROD_API_SECRET_KEY)
if (requestID) newRequest.headers.set("X-LZ-RequestID", requestID);
if (requestID) newRequest.headers.set("X-LZ-Request-ID", requestID);
const response = await fetch(newRequest);

// Force redirects to be relative because I couldn't get it to work in Spring Boot
Expand Down

0 comments on commit 5cc1789

Please sign in to comment.