Commit 3a005d0
Serve branded parked domains directly (Host-based tenant resolution) (#17)
* Use branded <dn>/… links for bid + affiliate on tenant pages
Inside a masked parked-domain iframe, the bid link was a relative /?bid=<dn>, so
it navigated the iframe to moshcoding.com/?bid=<dn> — which refuses to be framed
(no ?dn → CSP frame-ancestors blocks it): 'moshcoding.com refused to connect'.
And the affiliate share link exposed moshcoding.com/?dn=<dn>&ref=<code>.
Both now use the branded domain URL:
- Bid link → https://<dn>/?bid=<dn> with target=_top (breaks out of the iframe
to the branded domain instead of loading moshcoding.com in-frame)
- Affiliate share link → https://<dn>/?ref=<code>
- middleware also auto-allows the ?bid=<domain> as a frame-ancestor (like ?dn),
so a forwarded bid page renders in-frame
Note: the domain's forwarding must pass query params through (Porkbun masked
forwarding with path/query, or param forwarding) for ?ref/?bid to reach the app;
safeDomain already handles the appended-query case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Resolve tenant by Host header (serve branded domains directly, no iframe)
Porkbun MASKED forwarding serves a static frameset with a FIXED src
(moshcoding.com/?dn=<self>) and drops the visitor's query — so ?ref/?bid never
reach the app. That's unfixable with masked forwarding.
Fix: when the app is served DIRECTLY on a branded custom domain (Host is not
moshcoding.com / *.railway.app / localhost), resolve the tenant from the Host
header. The domain then renders its own tenant page natively — no iframe, no
CSP, and ?ref/?bid arrive intact. ?dn still wins (keeps the masked-iframe path
working), so this is backward-compatible.
Verified: Host moshscript.com → moshscript tenant page; +?ref sets the 90-day
mc_ref cookie natively; +?bid → BidPage; Host moshcoding.com → landing.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 0e11c2d commit 3a005d0
1 file changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
11 | 30 | | |
12 | 31 | | |
13 | 32 | | |
| |||
16 | 35 | | |
17 | 36 | | |
18 | 37 | | |
19 | | - | |
| 38 | + | |
20 | 39 | | |
21 | 40 | | |
22 | 41 | | |
| |||
42 | 61 | | |
43 | 62 | | |
44 | 63 | | |
45 | | - | |
| 64 | + | |
| 65 | + | |
46 | 66 | | |
47 | 67 | | |
48 | 68 | | |
| |||
0 commit comments