Skip to content

Commit

Permalink
Add headers to tell the API who we are
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Dec 4, 2024
1 parent fbf37a5 commit d085bc0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ export async function handleFetch({ event, request, fetch }) {
if (request.url.startsWith(DC_BASE)) {
// handle docker issues
event.url.protocol = "https";

// pass through session cookie
request.headers.append("cookie", event.request.headers.get("cookie") ?? "");

// tell the API who we are
request.headers.append("x-real-ip", event.getClientAddress());
request.headers.set(
"x-bypass-rate-limit",
env.BYPASS_RATE_LIMIT_SECRET ?? "",
);
}

return fetch(request);
Expand Down

0 comments on commit d085bc0

Please sign in to comment.