All requests seems to come from 127.0.0.1 with proxy device

Hi there,
On a big bare metal server, I launch several LXD containers to host different websites.

Http “routing” (domain1 to container1, domain2 to container2, etc) is made by NGINX which is also hosted in a LXD container (named proxy).

Ports 80 and 443 are redirected to my proxy container using proxy device.

 lxc config device add proxy myport443 proxy listen=tcp:0.0.0.0:443 connect=tcp:127.0.0.1:443
 lxc config device add proxy myport80 proxy listen=tcp:0.0.0.0:80 connect=tcp:127.0.0.1:80

My concern is about source IP seen by my web servers.
Every request is logged with 127.0.0.1 IP, is there a configuration to have the real client IP ?

Thanks

That’s pretty normal behavior for a proxy, but you can either not have this be a proxy by using the nat config key (but may not work with all network setups) or use the proxy_protocol option combined with the matching nginx plugin to have nginx log the right address.