Closed Bug 2052534 Opened 15 days ago Closed 1 day ago

Some site fails to load (NS_ERROR_UNKNOWN_HOST) under Happy Eyeballs — routed to a .onion Alt-Svc alternate with no fallback

Categories

(Core :: Networking: HTTP, defect, P2)

defect

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: kershaw, Assigned: kershaw)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

With network.http.happy_eyeballs_enabled=true, loading an origin that advertises its Tor onion service via Alt-Svc fails with NS_ERROR_UNKNOWN_HOST (0x804B001E) and remains broken across a normal reload (Ctrl+R); only a shift-reload recovers. The root cause is that HE routes the real transaction to the unreachable .onion alternate without validating it first, and when that fails, it does not fall back to the origin.

What happens (based on the log)

  1. The origin advertises its onion service as an HTTP/2 Alt-Svc alternate:

    alt-svc: h2="<alternate>.onion:443"; ma=86400; persist=1

    AltSvcMapping ctor https://<origin>:443 to <alternate>.onion:443
    AltSvcCache::UpdateAltServiceMappingWithoutValidation … <alternate>.onion

    The important part here is WithoutValidation, along with persist=1, which means the mapping is kept for 24 hours and persisted to disk.

  2. After that, every channel to the origin is routed to the .onion alternate:

    Alt Service Mapping Found https://<alternate>.onion:443 [https:<origin>:443:…]

  3. HE then tries to resolve the routed host, which is the .onion, while still using the origin’s conn-info (ci=<origin>:443[!h3]):

    MakeNewConnection … trans=<T>
    CreateHappyEyeballs ipPref=0
    HappyEyeballsEvent::Tag::SendDnsQuery id=0 hostname=<alternate>.onion
    HappyEyeballsEvent::Tag::SendDnsQuery id=1 hostname=<alternate>.onion

  4. That .onion resolution fails by design. Per RFC 7686, nsDNSService::PreprocessHostname returns NS_ERROR_UNKNOWN_HOST for any *.onion name when network.dns.blockDotOnion is true, which is the default. .onion is a special-use TLD: it is never resolved through DNS and is only reachable through Tor onion routing.

  5. There is then no fallback to the origin. The HE attempt fails, the transaction is closed with that error, and the error propagates to the channel:

    nsHttpTransaction::Close [this=<T> reason=804b001e]
    nsHttpTransaction::ShouldRestartOnResumptionError [… mResumptionAttempted=0 error=804b001e]

  6. The origin’s direct addresses are only reached later with shift-reload, because that bypasses the route and the cache.

Depends on: 2053499
Assignee: nobody → kershaw
Status: NEW → ASSIGNED
Pushed by kjang@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/5c7ef1192892 https://hg.mozilla.org/integration/autoland/rev/d5eb0226a2e1 Fall back to the origin when a Happy Eyeballs alt-svc route is unreachable, r=mxinden
Status: ASSIGNED → RESOLVED
Closed: 1 day ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: