Which conditions trigger Firefox to fall back to system DNS after a DoH certificate error?
0 reputation · 27 Nov 2023, 10:14 UTC
0 reputation · 27 Nov 2023, 10:14 UTC
Determine the exact circumstances under which Firefox, with DNS over HTTPS (DoH) enabled, silently reverts to the system resolver when encountering a certificate validation error during a DoH request.
31775 reputation · 27 Nov 2023, 19:25 UTC
A certificate validation error on the DoH endpoint does not trigger a silent fallback to the system resolver in current Firefox builds. Fallback is gated by network.trr.mode, and certificate failures are classified in the Trusted Recursive Resolver (TRR) code path as security errors, not as the transient network or server errors that fallback exists to absorb. This is the likely behavior based on how the mode policy and error classification are structured; it is version-sensitive, so verify against your specific build before relying on it.
Confirmed: DoH in Firefox runs through the TRR subsystem, and network.trr.mode controls the fallback policy:
Likely, pending verification on your build: in mode 1, the fallback path is designed for transient conditions — timeouts, unreachable servers, malformed responses. A TLS certificate validation failure is treated as a non-recoverable security failure, so the query is failed rather than downgraded to plain system DNS. In mode 2 the outcome is the same (no fallback) but for a different reason: fallback is disabled entirely.
The deciding factor is error classification, not the mode alone. Mode 1 permits fallback, but only for errors the TRR layer considers transient. A certificate error indicates the endpoint's identity could not be verified; silently downgrading to unencrypted system DNS after that would defeat the purpose of DoH, so it is handled as a hard failure. Treat any claim that "all TLS errors fall back" as outdated — this classification has shifted across versions.
Firefox does not surface a certificate-override dialog for DoH endpoints the way it does for websites, and there is no user-facing cache of the invalid DoH certificate to inspect. Diagnostics are exposed indirectly through TRR counters and console logging rather than a certificate store. The practical place to look is the internal networking/DNS diagnostics page and the Browser Console with TRR-related logging enabled.
Nightly, Beta, and Release are believed to share the same mode-gated fallback policy; differences are in logging verbosity and default preferences, not in the core decision. The OS affects how the system resolver is reached once fallback is permitted, but not whether a certificate error permits it. Because defaults and classification have changed across releases, reproducibility requires pinning both the build and the network.trr.* preferences.
about:config and record network.trr.mode and network.trr.uri.One caveat: because this behavior is version-sensitive, the single most useful diagnostic detail is the exact Firefox version and channel where you observed a fallback after a certificate error — that determines whether you're seeing a regression or intended older behavior.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.