nginx_tcp_proxy_module icon indicating copy to clipboard operation
nginx_tcp_proxy_module copied to clipboard

(WIP) PROXY protocol support

Open chendo opened this issue 10 years ago • 2 comments

This PR is a hack that implements PROXY protocol (http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt) which allows upstream TCP servers to be notified the original IP and port of the client.

Tested with nginx 1.7.9.

Sorry about whitespace changes and probable code quality as I'm not familiar with C and this is my first bit of work on an nginx module.

The function in question: https://github.com/yaoweibin/nginx_tcp_proxy_module/pull/110/files#diff-439a7558cb55631857d62112acec7449R237

Example configuration:

tcp {
  upstream backend {
    server 127.0.0.1:4221;

    accept_proxy on;
  }

  server {
    listen 4222;
    proxy_pass backend;
  }
}

Issues:

  • The destination IP and port is wrong. I can't seem to find a proper reference to the socket the connection was accepted on. We don't use the destination IP/port anyway so it's not critical for us.

chendo avatar Feb 10 '15 05:02 chendo

Remove the useless spaces is good for me. Thank you.

I'm reviewing this pull request.

yaoweibin avatar Feb 10 '15 12:02 yaoweibin

Hi, any news about this PR ?

aderumier avatar Apr 27 '16 04:04 aderumier