Does Caddy v2 support achieving the effect of Nginx's proxy_bind?

I want to achieve the effect of “nginx proxy_bind $remote_addr transparent;” with Caddy, but I couldn’t find relevant documentation. I need to pass the IP transparently because I can’t get information from the request headers.


ubuntu 22

I am using xcaddy to build Caddy, running it in Docker, and using a Caddyfile mounted on the host machine.

It’s best if you fill out the form instead of providing the information sparsely this way.

Anyways, I think there’s a confusion of what NGINX’s proxy_bind does. The proxy_bind directive sets the IP address/network interface used for making the call to upstream. For example, if you have 2 network interfaces, you use proxy_bind to tell NGINX which network card/interface to use.

If you need the client IP address to show at upstream, you most likely need to use Proxy Protocol.

Can you explain why you think proxy_bind is the correct approach?

1 Like

I’m very sorry, I will fill out the form carefully next time.

Secondly, because I can’t access the upstream servers (the clients’), I want to implement ‘nginx proxy_bind $remote_addr transparent;’ to achieve transparent forwarding.

I want the upstream server to be able to obtain the real client IP without configuring anything, instead of getting it from the request header or proxy protocol.

That’s not something we’ll support. Doing that is really complicated because it “breaks” how TCP normally works. As far as I can tell, it would require a bunch of complicated iptable rules on both the server and upstream to work.

The problem you should try to solve is actually getting control of your upstream. I don’t think it makes sense for us to implement this (or even try to, it’s not easy).


Thank you very much for your reply. I will consider other solutions.