Ngixg反向代理-真实IP

时间:2020-02-16 21:13:07

标签: nginx proxy reverse-proxy nginx-reverse-proxy

我无法将客户端的ip发送到nginx反向代理后面的后端服务器, 我已经使用proxy_set尝试了一些,但不幸的是没有运气

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;
 }
}

1 个答案:

答案 0 :(得分:0)

您可能忘记了proxy_set_header Forwarded $proxy_add_forwarded;