Reputation: 11
I have a server that host some lxc on it, and i forward what he get from port 8080 to the port 80 of my lxc
lxc profile create proxy-8080
lxc profile list
# first create a profile bound to the future local host
lxc profile device add proxy-8080 hostport8080 proxy connect="tcp:127.0.0.1:80" listen="tcp:0.0.0.0:8080"
# then attach profil to container
lxc profile add dev proxy-8080
It's works well, but on my lxc container, i don't see remote ip, i always see 127.0.0.1.
How can I set at least the x-forwarded-for flag to getting it in my container ?
Upvotes: 0
Views: 132
Reputation: 11
Finally i remove lxc profile and put a nginx to manage this as a proxy:
server {
listen 8080;
#server_name example.com;
location / {
proxy_pass http://xx.xx.xx.xx:80/;
#proxy_set_header Host $host;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Upvotes: 0