planb icon indicating copy to clipboard operation
planb copied to clipboard

log real client ip address

Open vmalaga opened this issue 7 years ago • 2 comments

Hi we are using planb behind a haproxy on tcp mode for handling ssl certificates with planb. We have more than 15000 domains with its certificates on redis and works fine.

Now we receive the x-forwarder-proto correctly, but at the planb logs only get the haproxy ipaddress, this may be caused because you do not receive the header, being haproxy on tcpmode.

Do you support the proxy-protocol from haproxy ?

http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt

planb log line

:ffff:172.16.70.41 - - [05/Nov/2017:20:53:39 +0000] "GET /es/ HTTP/1.1" 200 -1 "https://www.deltacartarragona.es/es/" "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 BingPreview/1.0b" "Swplanb:77adf0d5-0489-4d4a-7887-a3f9ea06f798" "www.deltacartarragona.es" "" 0.325 0.325

vmalaga avatar Nov 06 '17 00:11 vmalaga

We do not support proxy-protocol yet, however, after a quick look I think adding support to it should not be too difficult. It's probably possible to track new connections using http.Server.ConnState and read the PROXY protocol line from it before freeing the connection to be read by the http.Server. I may give this a try later.

cezarsa avatar Nov 06 '17 11:11 cezarsa

Hi @cezarsa

Do you have plans to merge the proxy-protocol support into planb master tree ?

vmalaga avatar Jul 09 '18 09:07 vmalaga