# DNS upstream pool upstream dns { zone dns 64k; server 127.0.0.1:53; }
# DNS over HTTPS (gateway) service # This time we’ve used a DoT upstream server { listen 127.0.0.1:8053; js_filter dns.filter_doh_request; proxy_ssl on; proxy_pass dot; } }
# This is our upstream connection to the njs translation process upstream dohloop { zone dohloop 64k; server 127.0.0.1:8053; }
# This virtual server accepts HTTP/2 over HTTPS server { listen 443 ssl http2; ssl_certificate /etc/nginx/ssl/certs/doh.local.pem; ssl_certificate_key /etc/nginx/ssl/private/doh.local.pem;
# Return 404 for non-DoH requests location / { return 404 "404 Not Found\n"; }
# Here we downgrade the HTTP/2 request to HTTP/1.1 and forward it to # the DoH loop service location /dns-query { proxy_http_version 1.1; proxy_set_header Connection ""; proxy_pass http://dohloop; } }