Nginx代理服务器返回错误的IP地址

我有一个运行这个configuration的Nginx代理:

server { listen 443 ssl; server_name jackett.example.com jackett.example.com; # SSL include /etc/nginx/confs/nginx-ssl.conf; # Authentication location /auth-admin { internal; proxy_pass https://www.example.com/auth.php?admin&whitelist=82.18.122.90; proxy_pass_request_body off; proxy_set_header Content-Length ""; proxy_set_header X-Original-URI $request_uri; } # Root block location / { auth_request /auth-admin; proxy_pass http://jackett:9117/; proxy_set_header Host $http_host; 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; # HTTP 1.1 support proxy_http_version 1.1; proxy_set_header Connection ""; } } 

Nginx和应用程序夹层运行在不同的docker容器中。 根位置/运行良好,但我想使用auth_request来validation用户。 我想将我的IP地址列入白名单,以便我可以随时访问它。 PHP脚本auth.php按以下顺序检查远程地址:

 Server variable Return value ------------------------------------------------------------- $_SERVER['HTTP_CLIENT_IP'] <empty> $_SERVER['HTTP_X_FORWARDED_FOR'] 172.19.0.1 $_SERVER['HTTP_X_FORWARDED'] <empty> $_SERVER['HTTP_FORWARDED_FOR'] <empty> $_SERVER['HTTP_FORWARDED'] <empty> $_SERVER['REMOTE_ADDR'] 172.19.0.10 

$_SERVER值都没有返回我的实际IP地址82.18.122.90 。 我不能更改PHP脚本,所以基本上我需要上述variables之一来返回我的实际IP地址。 我可以改变我的Nginxconfiguration中的东西来反映这个吗?

(82.18.122.90不是我的实际IP地址)