• December 25, 2024

Nginx Proxy_Pass Ipv6

Setting up Nginx with proxy_pass and IPV6 - Stack Overflow

Setting up Nginx with proxy_pass and IPV6 – Stack Overflow

The following code results in a 502 Bad Gateway. When I replace it with an IPV4 address the code works. How do I use proxy_pass with an IPV6 address?
server {
listen 80 ipv6only=on;
listen [::]:80 ipv6only=on;
server_name;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass [2a03:2880:f003:c07:face:b00c::2]:8080;}
asked Aug 18 ’18 at 22:43
gold badges113 silver badges186 bronze badges
3
Are you sure your host you are proxying toward supports ipv6?
Aug 18 ’18 at 22:48
The example address above is bogus – I can connect directly to my web cam running at an address that is formatted like this: [2a03:2880:f003:c07:face:b00c::2]:8080 in the browser.
Aug 18 ’18 at 23:23
@JZ did you find you the issue? the listen seems weird to me. You specify “listen 80” which is supposed to be ipv4 and then set “ipv6only=on”? Did you make sure the target is reachable with curl?
Jul 9 ’20 at 20:37
Disable IPv6 in nginx proxy_pass - Server Fault

Disable IPv6 in nginx proxy_pass – Server Fault

My server doesn’t have IPv6 adresses.
However, when I use Nginx proxy_pass to upstream with IPv4 and IPv6, sometimes it tries to send outgoing requests using IPv6:
2013/07/30 00:25:06 [error] 1930#0: *1482670 connect() to [AAAA:BBBB:C:DDD:E:F:GGG:HHH]:443 failed (101: Network is unreachable) while connecting to upstream, client:, server:, request: “GET /download/file HTTP/1. 0”, upstream: “[AAAA:BBBB:C:DDD:E:F:GGG:HHH]:443/download/file”, host: “”
How can I disable IPv6 for outgoing requests in proxy_pass?
upstream download {
server;
keepalive 8;}
location /download {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection “”;
proxy_ignore_headers X-Accel-Redirect;
proxy__version 1. 1;
resolver 8. 8. 8;
resolver_timeout 5s;
proxy_pass download;}
nginx -V:
nginx version: nginx/1. 4. 2
built by gcc 4. 7. 2 (Debian 4. 2-5)
TLS SNI support enabled
configure arguments: –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/ –error-log-path=/var/log/nginx/ —log-path=/var/log/nginx/ –pid-path=/var/run/ –lock-path=/var/run/ —client-body-temp-path=/var/cache/nginx/client_temp —proxy-temp-path=/var/cache/nginx/proxy_temp —fastcgi-temp-path=/var/cache/nginx/fastcgi_temp —uwsgi-temp-path=/var/cache/nginx/uwsgi_temp —scgi-temp-path=/var/cache/nginx/scgi_temp –user=nginx –group=nginx –with-_ssl_module –with-_realip_module –with-_addition_module –with-_sub_module –with-_dav_module –with-_flv_module –with-_mp4_module –with-_gunzip_module –with-_gzip_static_module –with-_random_index_module –with-_secure_link_module –with-_stub_status_module –with-mail –with-mail_ssl_module –with-file-aio –with-_spdy_module –with-cc-opt=’-g -O2 -fstack-protector –param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp, -D_FORTIFY_SOURCE=2′ –with-ld-opt=-Wl, -z, relro –with-ipv6
OS: Debian Wheezy
Linux 3. 2. 0-4-amd64 #1 SMP Debian 3. 46-1 x86_64 GNU/Linux
ip a
1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127. 0. 1/8 scope host lo
2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 6c:62:6d:7a:ea:af brd ff:ff:ff:ff:ff:ff
inet brd scope global eth0
Can nginx be used for ipv4 to ipv6 reverse proxy? - Reddit

Can nginx be used for ipv4 to ipv6 reverse proxy? – Reddit

Hi all, Is it possible to forward the incoming traffic to ipv6 internal address instead ipv4? If yes, what are configuration parameters needs to be set? Example => [2001:0db8:0a0b:12f0:0000:0000:0000:0001]:8080 or [2001:db8:a0b:12f0::1]:8080ThanksThis thread is archivedNew comments cannot be posted and votes cannot be cast
level 1Yes, you can use the the reverse proxy module to forward to an IPv6 address. Example config:server {
listen 80;
listen [::]:80;
server_name;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass [::1]:8886;}

Frequently Asked Questions about nginx proxy_pass ipv6

Leave a Reply