Skip to content

Commit

Permalink
fix(ip): Set x-forwarded-for header from gql to auth-server
Browse files Browse the repository at this point in the history
  • Loading branch information
vbudhram committed Jun 7, 2023
1 parent 0612880 commit 92a84a0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/fxa-graphql-api/src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export const GqlXHeaders = createParamDecorator(
// We don't need to propagate the authorization token because
// it needs to be updated to originate from gql server.
delete headers['authorization'];

// Set the x-forwarded-for header since the auth-server will use this
// to determine client geolocation
if (ctx.req?.ip) {
headers['x-forwarded-for'] = ctx.req?.ip;
}

return new Headers(headers);
}
);

0 comments on commit 92a84a0

Please sign in to comment.