Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-Forwarded-For IPs ordering issue #23

Open
rayrapetyan opened this issue Jun 15, 2013 · 1 comment
Open

X-Forwarded-For IPs ordering issue #23

rayrapetyan opened this issue Jun 15, 2013 · 1 comment

Comments

@rayrapetyan
Copy link

It's not clearly defined in RFC, but in wiki (http://en.wikipedia.org/wiki/X-Forwarded-For), squid (http://www.squid-cache.org/Doc/config/follow_x_forwarded_for/ btw - they're inventors of X-Forwarded-For thing) and varnish and many other proxies real-client IP is the left one.

Line 220:
headers['X-Forwarded-For'] = request.connection.remoteAddress + ", " + headers['X-Forwarded-For'];

Should be:
headers['X-Forwarded-For'] = headers['X-Forwarded-For'] + ", " + request.connection.remoteAddress;

p.s. however, some popular servers, like nginx, break this rule and define most recent address at the left (like in your current implementation).

@nodesocket
Copy link

Prefer the nginx implementation. Most recent to the left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants