ipV6 failing first time, working everytime subsequently

chakras nginx-forum at forum.nginx.org
Thu Jan 6 03:03:52 UTC 2022


I am using nginx on a VPS to proxy requests to a GCP server. When working
with IPv4, everything works as desired. However, if we enable IPv6 on client
machine, we see that the first call (/auth) fails with 401, and all
subsequent calls are successful. We cannot see the first call on GCP. I have
made sure that AAAA records do exist, GCP endpoint supports IPv6. This is my
configuration for Nginx (some values redacted).

server {
        listen                  80;
        listen                  [::]:80;
        server_name      xxxxx.us www.xxxxx.us;

        location / {
                return 301 https://xxxxx.us$request_uri;

server {
        listen                  443 ssl http2;
        listen                  [::]:443 ssl http2;
        server_name      xxxxx.us www.xxxxx.us;
        root                    /var/www/xxxxx.us/html;
        index                  index.html;

        # SSL
        ssl_certificate              fullchain.pem;
        ssl_certificate_key       privkey.pem;
        ssl_trusted_certificate  chain.pem;

        # Security
        include                      options-ssl-nginx.conf;
        ssl_dhparam             ssl-dhparams.pem;

        client_max_body_size    10M;

        location / {
                proxy_pass      https://xxxxx.appspot.com/;

        location /gcp/ {
                proxy_pass      https://xxxxx.appspot.com/;

Proxy pass /gcp/ is the one we are using for redirecting to GCP. I am always
getting the first call as 401, but second call (same), succeeds. Please let
me know if you have seen this before and what I can change to fix this.
Also, just to reiterate, if we disable IPv6 on the calling machine, there
are no issues.

Logs (two subsequent calls):
 "POST /gcp/users/auth HTTP/2.0" 401 0 "http://localhost:3000/"
 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/96.0.4664.11
0 Safari/537.36"

"POST /gcp/users/auth HTTP/2.0" 200 606 "http://localhost:3000
/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/96.0.4664.
110 Safari/537.36"


Posted at Nginx Forum: https://forum.nginx.org/read.php?2,293266,293266#msg-293266

nginx mailing list
nginx at nginx.org

More information about the nginx mailing list