ngx_http_proxy_connect_module icon indicating copy to clipboard operation
ngx_http_proxy_connect_module copied to clipboard

https and "X-Forwarded-For"?

Open shell1986 opened this issue 4 years ago • 1 comments

Hello, tell me how to send "X-Forwarded-For" using an https proxy? When I go to http, X-Forwarded-For is transmitted correctly, and when I use https it disappears.

` server { listen 8443; # dns resolver used by forward proxying resolver 1.1.1.1;

 # forward proxy for CONNECT request
 proxy_connect;
 proxy_connect_allow            443 563;
 proxy_connect_connect_timeout  10s;
 proxy_connect_read_timeout     10s;
 proxy_connect_send_timeout     10s;
 #set $ngx.var.http_x-forwarded-for $proxy_add_x_forwarded_for;

 location / {
   proxy_pass http://$host;
   proxy_set_header Host $host;
   proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
 }

} `

shell1986 avatar Oct 12 '21 00:10 shell1986

When I go to http, X-Forwarded-For is transmitted correctly, and when I use https it disappears.

For https, the raw data is proxied by this module directly, and it is SSL encrpted data. So we cannot insert 'X-forwarded-For' header ( or any other data) into the proxied data flow.

For http, this module does not work, it's proxied by nginx original http proxy module.

chobits avatar Oct 22 '21 02:10 chobits

think it resolved, if you still have any problem, feel free to reopen or file a new issue

chobits avatar Oct 01 '22 08:10 chobits