Skip to content

Commit

Permalink
Add HTTP-X-Forwarded-For (sergiodxa#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiodxa authored May 2, 2023
1 parent ea8fa3f commit a33c6a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/server/get-client-ip-address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getHeaders } from "./get-headers";
const headerNames = Object.freeze([
"X-Client-IP",
"X-Forwarded-For",
"HTTP-X-Forwarded-For",
"Fly-Client-IP",
"CF-Connecting-IP",
"Fastly-Client-Ip",
Expand All @@ -29,6 +30,7 @@ const headerNames = Object.freeze([
*
* - X-Client-IP
* - X-Forwarded-For
* - HTTP-X-Forwarded-For
* - Fly-Client-IP
* - CF-Connecting-IP
* - Fastly-Client-Ip
Expand Down
3 changes: 3 additions & 0 deletions test/server/get-client-id-address.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const INVALID_IP = "abc.def.ghi.jkl";
const headerNames = Object.freeze([
"X-Client-IP",
"X-Forwarded-For",
"HTTP-X-Forwarded-For",
"Fly-Client-IP",
"CF-Connecting-IP",
"Fastly-Client-Ip",
Expand All @@ -15,6 +16,8 @@ const headerNames = Object.freeze([
"X-Forwarded",
"Forwarded-For",
"Forwarded",
"DO-Connecting-IP" /** Digital ocean app platform */,
"oxygen-buyer-ip" /** Shopify oxygen platform */,
] as const);

describe(getClientIPAddress, () => {
Expand Down

0 comments on commit a33c6a8

Please sign in to comment.