0

I'm setting up nginx to cache files from S3.

I'm getting a random error.

2025/10/22 08:03:11 [error] 81#81: *4256 connect() to [ipv6]:443 failed (101: Network is unreachable) while connecting to upstream, client: 10.200.186.53, server: , request: "GET /a14feca0-274e-4265-a1c0-c541e50c3b99 HTTP/1.1", upstream: "https://[ipv6]:443/a14feca0-274e-4265-a1c0-c541e50c3b99", host: "nginx-s3-gateway.development"

2025/10/22 08:03:11 [warn] 81#81: *4256 upstream server temporarily disabled while Connecting to upstream, client: 10.200.186.53, server: , request: "GET /a14feca0-274e-4265-a1c0-c541e50c3b99 HTTP/1.1", upstream: "https://[ipv6]:443/a14feca0-274e-4265-a1c0-c541e50c3b99", host: "nginx-s3-gateway.development"

Everything is fine locally in Docker. This error appears in Cloud provider, and in the k8s pod, and on a separate Docker node. Could you tell me where to look for this problem? Network, DNS, or something else?

UPD. upstream is https://s3.yandexcloud.net And actually it's image https://github.com/nginx/nginx-s3-gateway that I use, so I cant provide exact nginx config.

2
  • 1
    How do you refer the upstream in the nginx configuration? Via the IP address or the domain name? It would be helpful to include the complete related nginx configuration snippet in your question. Commented Oct 27 at 11:21
  • I've updated initial post. Upstream is s3.yandexcloud.net and actually I dont use plain nginx but the ready image for this. Commented Oct 27 at 13:24

2 Answers 2

2

The s3.yandexcloud.net upstream can resolve to both IPv4 and IPv6 addresses:

s3.yandexcloud.net      canonical name = storage.yandexcloud.net.
Name:   storage.yandexcloud.net
Address: 213.180.193.243
Name:   storage.yandexcloud.net
Address: 2a02:6b8::1d9

Most likely, the node where your pod is running, as well as the separate node, has no IPv6 connectivity, so when nginx resolves the upstream to an IPv6 address instead of IPv4, you get the error you've shown. You need either to properly configure IPv6 support on that node or modify the following line in the nginx configuration template

resolver ${DNS_RESOLVERS};

as

resolver ${DNS_RESOLVERS} ipv6=off;

and then rebuild the container.

1
  • Thank you very much, Ivan! Your solution has worked. Commented Oct 28 at 10:02
2

Nginx is trying to reach out to an IPv6 address and your system does not support it. Default behavior for Nginx is to resolve upstream hostnames to IPv4 and IPv6. Typical occurrence with reverse proxy S3 gateways or proxy APIs that are dual-stacked for DNS resolution but you're only able to access using IPv4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.