Redirect other domains to campercan.net #13
Loading…
Reference in a new issue
No description provided.
Delete branch "cc-8-domain"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Makes https://campercan.net the canonical origin. Requests whose Host is in
redirectHosts(campercan.io, www.campercan.io, www.campercan.net) get a 301 to the same path and query on the canonical origin, before the method check. Any other host, including localhost and NPM's internal name, is served as before, so nothing loops.NPM must forward the original Host header (default). Both settings live in
src/site.json.Tested with
node build.jsandnode --test(16 pass). The new redirect test fails without the server change.Ticket: CC-8.
Two minor points, no blockers.
@ -76,6 +77,10 @@ function register(req, res) {}http.createServer((req, res) => {if (redirectHosts.includes((req.headers.host || '').replace(/:\d+$/, ''))) {Host match is case-sensitive, so
Campercan.IOis served instead of redirected. Lower-case the header before the lookup:.toLowerCase().@ -60,6 +60,13 @@ test('serves clean URLs, caching, CSP and refuses traversal', async () => {}});test('other domains 301 to the canonical origin, other hosts are served', async () => {Test only covers
campercan.iowith no port. Add a case with a port and awww.host (e.g.www.campercan.net:8080) so the port strip and the list entries are exercised.