Repository navigation
Commit 3860762
committed
fix(website): serve previews on the preview host instead of bouncing them back
Greptile caught what my own matrix could not: the previous fix made
`ema.tnsor.network/preview/888/` redirect to `nostream.dev/preview/888/`, whose
preview rule redirects to `ema.tnsor.network/preview/888/` - a two-host
browser redirect loop. Neither hop reaches the preview worker.
The matrix reported "preview host: redirect to canonical 301 ..." as correct.
It is not: one hop is only correct if the destination serves the page, and the
destination's own rule sends it back. The check that catches this class is
walking the chain the way a browser does, not asserting a single hop - which is
what this commit adds to the reasoning, and what the evidence below records.
A preview path on PREVIEW_HOST is now served in place by the proxy branch;
every other authority still converges on the canonical host, and previews on
the production host still move to PREVIEW_HOST once, then stop there.
Chain walks, six starts, no path revisits a URL:
ema.../preview/888/ -> 404 (proxied, one hop, terminal)
ema.../preview/888/docs/x?y=1 -> 404 (query and path preserved)
http://ema.../preview/888/ -> https ema -> 404
ema.../about -> nostream.dev/about -> 200
nostream.dev/preview/888/ -> ema.../preview/888/ -> 404
nostream.dev/about -> 200
www.nostream.dev/ -> nostream.dev/ -> 2001 parent 1c86cac commit 3860762
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
0 commit comments