nginx / nginx/docker-nginx

Upstream lookup returns IPv6 address on Alpine

Open
#374 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
3.5k
Forks
1.8k
Avg merge
42m
Merged PRs (30d)
2

Description

Using this (partial) configuration:

    resolver                   8.8.8.8 valid=300s ipv6=off;
    resolver_timeout           10s;
    upstream gs {
        server storage.googleapis.com:443;
        keepalive 128;
    }
    server {
        location / {
            proxy_set_header    Host storage.googleapis.com;
            proxy_pass          https://gs/$bucket_name$uri;
            proxy_http_version  1.1;
            proxy_set_header    Connection "";
        }
    }

on nginx:1.17-alpine getting errors:

*758 connect() to [2a00:1450:4001:824::2010]:443 failed (101: Network unreachable) while connecting to upstream, client: 10.12.0.1, server: , request: "GET / HTTP/1.1", upstream: "https://[2a00:1450:4001:824::2010]:443/example.com/index.html", host: "10.156.0.15"
*758 upstream server temporarily disabled while connecting to upstream, client: 10.12.0.1, server: , request: "GET / HTTP/1.1", upstream: "https://[2a00:1450:4001:824::2010]:443/example.com/index.html", host: "10.156.0.15"

The proxying did still work, apparently it was getting both IPv4 and IPv6 addresses, successfully using the IPv4 ones.

This is while running on Google's Kubernetes Engine (GKE) which does not support IPv6 networking.

Switching to nginx:1.17 made the errors disappear, so I assume the Alpine setup is missing something the Debian setup does.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied resolver and upstream configuration with nginx:1.17-alpine, then compare it with nginx:1.17, focusing on IPv6 resolution and the image setup. Done means the Alpine image no longer attempts unreachable IPv6 upstream connections when ipv6=off is configured, while IPv4 proxying continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, nginx
Domain
infrastructure, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.