dnslookup icon indicating copy to clipboard operation
dnslookup copied to clipboard

1.9.2 compatibility issues with nginx HTTP/3

Open ZeroClover opened this issue 10 months ago • 2 comments

Because I don't want to use the default Path /dns-query, I run AGH (AdGuard Home) behind nginx so that I can modify the path.

Here is my nginx configuration snippet:
upstream agh {
        server 127.0.0.1:12345;
      }

map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

server {
	listen 443 ssl reuseport;
        listen [::]:443 ssl reuseport;
	listen 443 quic reuseport;
	listen [::]:443 quic reuseport;
        http2 on;

        server_name dns.domain.tld;

        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
	add_header Alt-Svc 'h3=":443"; ma=86400' always;

...

        location /mypath {
                proxy_pass https://agh/dns-query;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $connection_upgrade;
                proxy_set_header Host      $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Scheme $scheme;
                proxy_set_header Accept-Encoding '';
                proxy_redirect   off;
                proxy_buffering off;
        }

nginx version:

nginx -V
nginx version: nginx/1.25.2
built with OpenSSL 3.1.2+quic 1 Aug 2023

There are no issues when using dnslookup 1.9.1, but when using 1.9.2, queries cannot be completed:

dnslookup google.com h3://dns.domain.tld/mypath
dnslookup v1.9.2
2023/09/08 04:08:04 [fatal] Cannot make the DNS request: requesting https:///dns.domain.tld:443/mypath: Get_0rtt "https:///dns.domain.tld:443/mypath?dns=AAABAAABAAAAAAAABmdvb2dsZQNjb20AAAEAAQ": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

But there is no issue in other DoH clients that support HTTP/3 (including AGH itself).

I'm not quite sure what caused the problem, if you could take the time to check this issue, I would be very grateful.

ZeroClover avatar Sep 07 '23 20:09 ZeroClover