Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into the-big-apollo-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-macpherson committed Sep 19, 2024
2 parents 319c5f3 + 866fc1d commit 19155ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/web/resolvers/utils/getPostingIpAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ const isNextRequest = (req: NextRequest | Request): req is NextRequest => {
export const getPostingIpAddress = (req: NextRequest | Request) => {
if (isNextRequest(req)) return req.ip

const headers = req?.headers['X-Forwarded-For']
const headers =
req?.headers['x-forwarded-for'] ||
req?.headers['x-real-ip'] ||
req?.headers['X-Forwarded-For'] ||
req?.headers['X-Real-IP']
if (typeof headers === 'string') return headers.split(',')?.[0]

return undefined
Expand Down

0 comments on commit 19155ab

Please sign in to comment.