feat: canonicalize www.seofixkit.com onto the apex host with 301 redirects - #70
Conversation
…rects www.seofixkit.com stays attached as a custom domain only so its requests reach the Worker, which now 301-redirects every one of them onto the apex host with path and query intact before any route logic runs. Every URL the Worker emits (page canonicals, social tags, robots.txt, sitemap.xml, llms.txt, fixture URLs) is generated from the apex origin, so canonicals and the sitemap are apex-only regardless of the request hostname. Offline locks: - worker/index.test.mjs pins the 301s (root, deep path with query, API route, sitemap) and apex-only canonicals/robots/sitemap/llms.txt. - scripts/live-promise-spot-check.mjs adds canonicalHostSpotChecks so the deployed Worker's www redirect is spot-checked like the other README promises (redirect: manual keeps the 301 observable), with pass and failure-mode tests. Docs: - README Custom domain section states the canonical-host behavior; the spot-check paragraph covers the www redirect.
There was a problem hiding this comment.
nish3451 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Warning Review limit reached
Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1115d2a76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (url.hostname.toLowerCase() === `www.${CANONICAL_HOST}`) { | ||
| return new Response(null, { | ||
| status: 301, | ||
| headers: secureHeaders({ Location: `${CANONICAL_ORIGIN}${url.pathname}${url.search}` }) |
There was a problem hiding this comment.
Route all www paths through the Worker
With the production wrangler.jsonc inspected here, assets.not_found_handling is single-page-application and assets.run_worker_first is only a path allowlist, so requests such as https://www.seofixkit.com/old-page or direct static-asset URLs can be answered by Static Assets without ever reaching this redirect. Those requests can therefore return 200 instead of the promised 301; route all paths through the Worker, or otherwise enforce the redirect before asset handling.
AGENTS.md reference: AGENTS.md:L7-L7
Useful? React with 👍 / 👎.
| for (const { name, value, reason } of check.expectedHeaders || []) { | ||
| const header = response.headers.get(name) || ""; | ||
| if (!hasContent(header, value)) { | ||
| failures.push(reason || `missing ${name} header matching ${typeof value === "string" ? value : value.toString()}`); |
There was a problem hiding this comment.
Compare redirect Locations exactly
For the newly added redirect checks, string expectations are evaluated with includes, so an incorrect header such as https://seofixkit.com/check?utm_source=spot-check&unexpected=1 still passes even though the query was not preserved intact. Because Location has a single exact expected value here, compare it for equality rather than using the body-content matcher.
Useful? React with 👍 / 👎.
Item 38147c59f9 (canonicalize www.seofixkit.com onto the apex host with 301 redirects and apex-only canonicals/sitemap) is already implemented, tested, and live on origin/main. PR #70 (commit c05fae5, 2026-08-09) shipped the 301 + apex-only canonicals/robots/sitemap/llms.txt, and this worktree's worker-dispatch suite pins it (12/12 pass). Re-verified independently today: live www.seofixkit.com root, deep path with query, sitemap.xml, favicon.svg, and llms.txt all 301 to the apex; apex sitemap/robots/canonicals are apex-only. No code change needed; report only. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
(#153) Item 38147c59f9 (canonicalize www.seofixkit.com onto the apex host with 301 redirects and apex-only canonicals/sitemap) is already implemented, tested, and live on origin/main. PR #70 (commit c05fae5, 2026-08-09) shipped the 301 + apex-only canonicals/robots/sitemap/llms.txt, and this worktree's worker-dispatch suite pins it (12/12 pass). Re-verified independently today: live www.seofixkit.com root, deep path with query, sitemap.xml, favicon.svg, and llms.txt all 301 to the apex; apex sitemap/robots/canonicals are apex-only. No code change needed; report only. Co-authored-by: fleet-dispatch <fleet-dispatch@local> Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
…21f0364 (#162) Item 38147c59f9 (canonicalize www.seofixkit.com onto the apex host with 301 redirects and apex-only canonicals/sitemap) is already implemented, tested, and live on origin/main. PR #70 (commit c05fae5, 2026-08-09) shipped the 301 + apex-only canonicals/robots/sitemap/llms.txt; PR #107 (commit f5b2349) extended it to static assets via run_worker_first. Re-verified today against origin/main at 21f0364: npm run test:worker-dispatch passes 12/12 (covers www root, deep path with query, /api/health, /sitemap.xml, asset layer /favicon.svg + /assets/*); repo has no www serving URL anywhere outside the redirect logic, its regression locks, the deliberate app-host allowlists, the wrangler routes config, and the live spot-check script. Live spot checks: www root, /packages?utm_source=scout, /sitemap.xml, /favicon.svg, and /llms.txt all 301 to apex with path/query intact; apex sitemap/robots/ canonicals are apex-only. No code change needed; report only. Co-authored-by: fleet-dispatch <fleet-dispatch@local>
…7783adc (#171) Item 38147c59f9 (canonicalize www.seofixkit.com onto the apex host with 301 redirects and apex-only canonicals/sitemap) is already implemented, tested, and live on origin/main. PR #70 (commit c05fae5, 2026-08-09) shipped the 301 + apex-only canonicals/robots/sitemap/llms.txt; #107 added run_worker_first so www static assets 301 too; #89 hardened the live spot-check. Re-verified today against origin/main at 7783adc: test:worker-dispatch 14/14, test:public-pages 15/15, test:promise-audit 71/71; live www root, deep path with query, sitemap.xml, llms.txt, favicon.svg, well-known and SPA-fallback paths all 301 to the apex with path/query intact; apex sitemap/robots/canonicals are apex-only. No code change needed; report only. Co-authored-by: fleet-dispatch <fleet-dispatch@local> Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
What
Closes lane 1:
www.seofixkit.comnow 301-redirects onto the apex hostseofixkit.com, and every URL the Worker serves (page canonicals, social tags,robots.txt,sitemap.xml,llms.txt, fixture URLs) is generated from the apex origin — so canonicals and the sitemap are apex-only.How
worker/index.js— thewww.seofixkit.comcustom domain stays attached only so its requests reach the Worker; the fetch handler now 301-redirects every www request to the apex host with path and query intact before any route logic runs.canonicalOrigin()coerces the apex/www host family tohttps://seofixkit.comfor all content generation (pages, robots, sitemap, llms.txt, fixtures) as defense in depth; other hosts (local dev, preview) keep their own origin.worker/index.test.mjs— pins the 301s (root, deep path with query, API route, sitemap) and apex-only canonicals/robots/sitemap/llms.txt on the apex host.scripts/live-promise-spot-check.mjs— addscanonicalHostSpotChecksso the deployed Worker's www redirect is live spot-checked like the other README promises (redirect: "manual"keeps the 301 observable; header expectations verify the apexLocationwith path+query preserved). Runner supportscheck.url,check.expectedHeaders, andcheck.redirectManual.scripts/live-promise-spot-check.test.mjs— coverage, pass, and failure-mode tests (www serving 200; redirect dropping path/query).README.md— Custom domain section documents the canonical-host behavior; spot-check paragraph covers the www redirect.Validation
npm run check(the single PR gate): exit 0 — 311 tests pass, 0 fail,vite buildsucceeds.npm run audit:live-promiseis the opt-in live check (not run in CI); it now also verifies the deployed www redirect once this ships.Note:
public/robots.txtandpublic/sitemap.xmlwere already apex-only and are shadowed by the Worker routes, so no change was needed there.