Opened 6 years ago

Closed 6 years ago

#1655 closed defect (duplicate)

Nginx does not use Proxy??

Reported by: tns.takuya.okuyama@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.10.x
Keywords: proxy https_proxy http_proxy ssl Cc:
uname -a: Linux its-dev-ubuntu-06 4.15.0-1023-azure #24~16.04.1-Ubuntu SMP Wed Aug 29 12:54:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.10.3 (Ubuntu)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/ --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads


My nginx is working as "Reverse Proxy" in our company intranet. It does bypass the request from a client to an external server(internet/ssl).

I would like to make it uses our company proxy when it access to an external server. Is it possible?

I have tried to set "http_proxy" and "https_proxy" as environment value and tried CURL and WGET, they works fine.
But nginx seems not to use it(https_proxy value), it has access the ext server without the proxy.
Is there any configuration what I have to do?

my environment is below:

$ cat /etc/environment
export http_proxy=
export ftp_proxy=
export https_proxy=
export no_proxy=localhost

$ cat /etc/nginx/conf.d/site.conf

location /test/api/{

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host-Real-IP $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-Pcol http;

proxy_ssl_verify off;
proxy_pass https://<external server>:443/test/api/;
proxy_redirect default;



Change History (1)

comment:1 by Maxim Dounin, 6 years ago

Resolution: duplicate
Status: newclosed

No, nginx does not use forward proxies to connect to external resources. If you need nginx to connect to a server which is only available through a forward proxy, consider configuring a tunnel. Duplicate of #1399.

Note: See TracTickets for help on using tickets.