I'm having trouble getting the client's ip sent to the backend server behind an nginx reverse proxy, I've tried a little of each with the proxy_set but unfortunately without luck
server {
listen 443 ssl http2;
# SSL config
ssl on;
ssl_certificate /etc/nginx/ssl/domain/domain.net.pem;
ssl_certificate_key /etc/nginx/ssl/domain/domain.net.key;
server_name domain.net www.domain.net;
set $upstream 10.0.1.10;
location / {
proxy_pass_header Authorization;
proxy_pass https://$upstream;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
}
}
你可能忘记了proxy_set_header Forwarded $proxy_add_forwarded;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.