OverviewFilesCommitsIssuesDocsReleasesPeers

7rnx-proxy commits / 267fcec

7rnx-proxy: wildcard vhost (*.7rnx.net -> edge) for fleet pretty names
One wildcard vhost fronts every subdomain, proxied to the edge PDS which resolves each handle via the fleet directory and serves it over Hyperswarm. So any fleet member's pretty name (tabertron.7rnx.net, alice.7rnx.net, ...) works publicly with NO per-member vhost and no gateway dependency (edge->home is swarm-relayed). - registry.addHost: accept a wildcard serverName (*.7rnx.net); validate the base domain. - generateVhosts: for a wildcard, emit a concrete ServerName + ServerAlias *.7rnx.net (Apache matches exact ServerNames first, so pds/p2p still win; the apex 7rnx.net path-site is untouched since *.7rnx.net doesn't match it). Deployed to 7rnx.net (configtest OK, rollback-safe). Verified live: random/tabertron/ anything.7rnx.net now route to the edge; tabertron.7rnx.net resolves its DID + serves its repo through the edge over the swarm. Tests 32/0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
267fcecb672e62549884cc2996d67f4ee74a13ee
by plankatron <fleeky@gmail.com> · 2026-07-03T18:28:26.000Z

Changed files (2) +17 -3

lib/config-generator.js +11 -2
……@@ -31,14 +31,23 @@ export function generateVhosts (registry) {
3131 if (!node) continue
3232 assertSafe(node.ip, 'node ip')
3333 assertSafe(h.name, 'host name')
34 if (!/^[a-z0-9.-]+$/i.test(h.serverName)) {
34 if (!/^(\*\.)?[a-z0-9.-]+$/i.test(h.serverName)) {
3535 throw new Error(`unsafe serverName for Apache config: ${JSON.stringify(h.serverName)}`)
3636 }
3737 const backend = `http://${node.ip}:${h.port}`
38 const wildcard = h.serverName.startsWith('*.')
3839
3940 lines.push(`# === ${h.name} → ${h.serverName} → ${node.ip}:${h.port} ===`)
4041 lines.push('<VirtualHost *:443>')
41 lines.push(` ServerName ${h.serverName}`)
42 // A wildcard needs a concrete ServerName + a ServerAlias for the glob (Apache matches
43 // exact ServerNames first, so specific vhosts like pds.7rnx.net still win). Subdomains
44 // only — *.7rnx.net does not match the apex 7rnx.net (its path-based site is untouched).
45 if (wildcard) {
46 lines.push(` ServerName ${h.serverName.replace('*', 'wildcard')}`)
47 lines.push(` ServerAlias ${h.serverName}`)
48 } else {
49 lines.push(` ServerName ${h.serverName}`)
50 }
4251 lines.push(' SSLEngine on')
4352 lines.push(' # mod_md supplies the *.7rnx.net certificate for this host.')
4453 lines.push(' ProxyPreserveHost On')
lib/registry.js +6 -1
……@@ -146,7 +146,12 @@ export class Registry {
146146 if (!name || !port || !serverName) throw new Error('name, port, and serverName are required')
147147 if (!PETNAME_RE.test(name)) throw new Error(`invalid host name "${name}" (allowed: letters, digits, "-", "_")`)
148148 if (!validPort(port)) throw new Error(`invalid port "${port}"`)
149 if (!HOSTNAME_RE.test(serverName)) throw new Error(`invalid serverName "${serverName}" (must be a FQDN like p2p.7rnx.net)`)
149 // Allow a wildcard serverName (*.7rnx.net) — one vhost fronts every subdomain, routed to
150 // the edge which resolves each handle via the fleet directory. Validate the base domain.
151 const wildcard = serverName.startsWith('*.')
152 if (!HOSTNAME_RE.test(wildcard ? serverName.slice(2) : serverName)) {
153 throw new Error(`invalid serverName "${serverName}" (must be a FQDN like p2p.7rnx.net, or a wildcard like *.7rnx.net)`)
154 }
150155
151156 if (this.data.hosts.find(h => h.name === name)) throw new Error(`Host "${name}" already exists`)
152157 const dupServer = this.data.hosts.find(h => h.serverName === serverName)