fix(lookup): keep the onion apex from redirecting to a clearnet homepage

On a Tor node current_play_redirect_domains schedules the bare node
onion as a redirect source targeting DOMAIN_HOMEPAGE. Without
web-app-dashboard, DOMAIN_HOMEPAGE falls back to SOFTWARE_DOMAIN
(infinito.nexus), so web-opt-rdr-domains rendered a 301 from
http://<node>.onion/ to http://infinito.nexus/: an onion visitor sent
to a clearnet host over plain HTTP.

The onion apex entry is now added only when DOMAIN_HOMEPAGE is an
onion host. Otherwise the onion apex gets no redirect and the default
server answers.

Closes #924

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-14 13:35:29 +02:00
1 parent 88d0cd8308
commit 45732329b6
2 files changed
+24 -4

No files matched your search

@@ -334,6 +334,21 @@ class CurrentPlayRedirectDomainsLookupTests(unittest.TestCase):
[{"source": "infinito.test", "target": "abcdefonion.onion"}],
)
def test_onion_apex_absent_when_homepage_is_clearnet(self):
lm = self._make_lookup()
variables = self._onion_variables(
DOMAIN_HOMEPAGE="infinito.nexus",
group_names=["svc-net-tor"],
)
with self._patch_lookups(
deployed=["web-opt-rdr-domains"], current_play_apps={}
):
result = lm.run(terms=[], variables=variables)[0]
self.assertEqual(
result,
[{"source": "infinito.test", "target": "infinito.nexus"}],
)
def test_onion_apex_node_value_templated(self):
class _ResolvingTemplar:
def __init__(self, mapping):