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

PROXY protocol v1 / v2 support #61

Open
elrik75 opened this issue Mar 1, 2021 · 0 comments
Open

PROXY protocol v1 / v2 support #61

elrik75 opened this issue Mar 1, 2021 · 0 comments

Comments

@elrik75
Copy link

elrik75 commented Mar 1, 2021

Behind a reverse-proxy or a load balancer, you often need to get the original client IP.
A lot of load balancer provide these information with the PROXY protocol - HAproxy for exemple.
I have a load balancer that provide only this method to get the client info, and I would not be the only one.

Here a doc of the protocol: http://www.haproxy.org/download/2.4/doc/proxy-protocol.txt

In a nutshell, it's one line added on top of the body, here for the v1 protocol:

    PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n
    GET / HTTP/1.1\r\n
    Host: 192.168.0.11\r\n
    \r\n

This protocol is implemented in Gunicorn, and can be activated with --proxy-protocol: https://docs.gunicorn.org/en/stable/settings.html#proxy-protocol

edit: A NodeJS parser: https://github.com/racker/node-proxy-protocol/blob/master/index.js

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

1 participant