HTTP/2 multiplexing allows multiple requests to be served over a single Tor circuit, eliminating the per-request circuit setup overhead that makes .onion sites feel slow. nginx supports HTTP/2 natively with simple configuration changes:
server {
listen 127.0.0.1:8080 http2;
# ... rest of config
}
HTTP/2 requires TLS in most browsers, but Tor Browser's .onion handling bypasses this requirement through Tor's built-in encryption. Verify HTTP/2 is active by checking nginx error logs for protocol version errors, or use curl -v --proxy socks5h://127.0.0.1:9050 http://YOUR_ONION_ADDRESS/ and look for HTTP/2 in the response headers.
Persistent connection tuning also helps significantly. Configure keepalive settings to maintain circuit connections across multiple requests:
keepalive_timeout 65; keepalive_requests 100;