Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit a5ad70c

Browse files
committed
add fallback in x-forwarded-for
1 parent c1d18f8 commit a5ad70c

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/http-proxy/passes/web-incoming.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module.exports = {
6969

7070
const encrypted = req.isSpdy || common.hasEncryptedConnection(req);
7171
const values = {
72-
For: req.headers["CF-Connecting-IP"] || req.connection.remoteAddress || req.socket.remoteAddress,
72+
For: req.headers["cf-connecting-ip"] || req.headers["x-forwarded-for"] || req.connection.remoteAddress || req.socket.remoteAddress,
7373
Port: common.getPort(req),
7474
Proto: encrypted ? "https" : "http",
7575
};

lib/http-proxy/passes/ws-incoming.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = {
4747
if (!options.xfwd) return;
4848

4949
const values = {
50-
For: req.headers["CF-Connecting-IP"] || req.connection.remoteAddress || req.socket.remoteAddress,
50+
For: req.headers["cf-connecting-ip"] || req.headers["x-forwarded-for"] || req.connection.remoteAddress || req.socket.remoteAddress,
5151
Port: common.getPort(req),
5252
Proto: common.hasEncryptedConnection(req) ? "wss" : "ws",
5353
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@squarecloud/http-proxy",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/squarecloudofc/http-proxy.git"

0 commit comments

Comments
 (0)