When doing this haproxy logs show traffic coming from remote ip address 127.0.0.1 which is not right. I need the actual client ip, to be passed to haproxy even if its in X-Forward-For header.
Is it possible?
If its not possible what will be your suggestion?
The simple solution I can think of at present is to install haproxy from container to physical host.
It’s not possible with the way the proxy device works right now.
There is a protocol that exists for sending the client address in such cases and is supported by nginx, haproxy and a few others. We could in theory add support for that as an option that can be turned on in the proxy, but it’d need the receiving end to be aware of it.
We do have another issue open right now to support doing straight iptables in cases where forwarding with it is possible.
Hi. Sorry to dig this old topic. But is there a ticket for this problem to follow on git? Can it be solved with device or iptables now in the latest version of lxd/lxc?
I have an interface on the target instance with a static IP, but that IP is set inside the target instance and not using lxd. When I try to set nat=true on the lxd device, I get this:
$ lxc config device set up-rat http listen=tcp:<host_external_ip>:80 nat=true connect=tcp:<target_instance_ip>:80
Error: Failed to start device “http”: Proxy connect IP cannot be used with any of the instance NICs static IPs
Does this require that lxd be managing the interface? Does nat=true require that iptables be running on the host?
If you tell LXD about the static IP using lxc config device set <instance> eth0 ipv4.address=n.n.n.n then it will know which IP to setup for the DNAT entry (using either iptables or nftables).