Skip to content

Commit

Permalink
chore: optimizes reading of X-Forwarded-For header
Browse files Browse the repository at this point in the history
  • Loading branch information
akoenig committed May 6, 2024
1 parent eb66382 commit e32a8e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/routes/$category.$id/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export async function loader({ params, request }: LoaderFunctionArgs) {

const domain = baseUrl.host;

console.log("X-Forwarded-For", request.headers.get("X-Forwarded-For"));
const xForwardedFor = request.headers.get("X-Forwarded-For");

console.log("X-Forwarded-For", xForwardedFor);

try {
const response = await fetch(
Expand All @@ -42,7 +44,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
headers: {
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
"X-Forwarded-For": request.headers.get("X-Forwarded-For") ?? "",
"X-Forwarded-For": xForwardedFor,
"Content-Type": "application/json",
"X-Debug-Request": "true",
},
Expand Down

0 comments on commit e32a8e1

Please sign in to comment.