FULL AI ANALYSIS

Why does the browser show a different TLS certificate when proxying through my Nginx reverse proxy?

Generated Nov 6, 2026, 9:29:48 AM

Analysis summary

Name mismatch typically means the TLS server the client reached presented a cert without the expected SAN. In reverse-proxy setups this can be caused by proxy terminating TLS (presenting its own cert), proxy forwarding TLS to upstream while not setting SNI, upstream using a fallback cert, or DNS/hosts misdirection. Each hypothesis has different diagnostics.

Possible causes

Nginx is proxying TLS to upstream but is not sending SNI to the upstream, so upstream returns a default/fallback certificate.

60%

Nginx is terminating TLS and serving a certificate for the wrong host (misconfigured server_name/cert files).

50%

Upstream has only a self-signed or single-host certificate (upstream.example.local) and isn't configured with the requested hostname.

45%

DNS or /etc/hosts on the proxy or client points hostname.example.com to the upstream IP directly, bypassing correct proxy virtualhost.

20%

Suggested fixes

1

Diagnostic step 1

From a machine that follows the same path as the browser, run an SNI-aware TLS client (openssl s_client -connect proxy:443 -servername hostname.example.com) and record the certificate subject and SANs presented. Result meaning: If the presented cert matches hostname.example.com, the proxy is correctly presenting that cert. If it matches upstream.example.local, the proxy is forwarding TLS or the client is reaching the upstream directly. If a default/fallback cert appears, SNI likely not delivered to the TLS server that answered.

2

Diagnostic step 2

Run the same command but target the upstream socket (openssl s_client -connect 10.0.0.20:8443 -servername hostname.example.com) and compare the certificate returned when SNI is set versus omitted. Result meaning: If adding -servername changes the cert to the expected hostname, the upstream supports SNI but returned the fallback when SNI was missing; proxy must forward SNI. If the upstream never returns hostname.example.com, the upstream lacks that certificate.

3

Diagnostic step 3

Inspect Nginx config for ssl_certificate/server_name and for proxying directives: check whether proxy terminates TLS (listen 443 with ssl_certificate) or proxies TLS transparently (proxy_pass https://...). Check for proxy_ssl_server_name on upstream block. Result meaning: If Nginx has ssl_certificate configured, it terminates TLS and must serve the correct cert. If Nginx proxies TLS to upstream with proxy_pass https:// and proxy_ssl_server_name off/default, the upstream will not receive SNI and may return a fallback cert; enabling proxy_ssl_server_name can forward SNI.

4

Diagnostic step 4

Check hosts/DNS resolution on client and proxy (dig/host) for hostname.example.com to confirm requests go to intended proxy IP. Result meaning: If DNS resolves to the upstream IP, client bypasses proxy and will see the upstream cert. If DNS resolves to proxy IP, but proxy still shows upstream cert, problem is proxy-side TLS handling.