Skip to content

Commit

Permalink
Merge pull request #15422 from mozilla/fxa-6858
Browse files Browse the repository at this point in the history
fix(ip): Set x-forwarded-for header from gql to auth-server
  • Loading branch information
vbudhram authored Jun 15, 2023
2 parents db56b87 + 92a84a0 commit d8eb1e4
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 d8eb1e4

Please sign in to comment.