jpillora / go-tcp-proxy

A small TCP proxy written in Go
MIT License
761 stars 197 forks source link

how do u get the real ip of the originating ip from a reverse proxy? #19

Open gitmko0 opened 3 years ago

gitmko0 commented 3 years ago

e.g. [client] -> [tcp proxy] -> [https terminator] <== this one gets 127.0.0.1 because tcp proxy is 127.0.0.1. how to get the ip of the client?

synaesthesia commented 3 years ago

You can get it in the New() function: lconn.RemoteAddr().String()

jpillora commented 3 years ago

You can't. Originating IPs are passed through higher-level protocols (HTTP here for example), there is no place in a TCP to store it - all you see is the proxy IP.

dreams-money commented 10 months ago

Is it possible to modify the tcp packet and add it at the app level?