Subdomain Routing
The worker uses a SUBDOMAIN_ORIGINS map to route requests based on the Host header.
Extraction
Section titled “Extraction”function extractSubdomain(hostname) { const match = hostname.match(/^(.+)\.cubecommons\.org$/); if (!match || match[1] === 'www') return null; return match[1];}Multi-level subdomains are supported: sustainability-transparency.cubecommons.org extracts as sustainability.transparency.
Apex Redirect
Section titled “Apex Redirect”Requests to bare cubecommons.org redirect to either:
home.cubecommons.orgif the user has a validcc_accesscookietoken.cubecommons.orgif not authenticated
Cross-Subdomain Auth
Section titled “Cross-Subdomain Auth”Cookies are set with Domain=.cubecommons.org so they work across all subdomains. The cc_access cookie carries the token, and cc_sid carries the TOTP session.