Skip to content

fix(crawler,rules): no default Accept-Language; redirected pages are not duplicates of their target #1355 - #1357

Closed
nc9 wants to merge 2 commits into
mainfrom
fix/1355-accept-language-redirect-dups
Closed

nc9 wants to merge 2 commits into
mainfrom
fix/1355-accept-language-redirect-dups

Conversation

@nc9

@nc9 nc9 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1355

What

  1. No default Accept-Language. The page fetcher (standard and browser-header paths), the CLI request tool, robots.txt, sitemap and redirect-chain fetches no longer add en-US,en;q=0.9. A value in [crawler] headers still goes through unchanged (custom headers are merged over the defaults). The cache request context used to carry the fixed en-US value; it now carries a configured Accept-Language only. The cache matches on Vary field names, so only pages served with Vary: Accept-Language are refetched; a site that redirected by language without Vary keeps its cached redirect until --refresh (said in the CHANGELOG and docs).
  2. A page that redirected to another crawled page is counted once. redirectedAway(url, finalUrl, crawled) and crawledPageKeys in @squirrelscan/utils/url: both sides go through the same normalizePageUrl (case, default port, fragment, trailing slash), and a requested URL is skipped only when its final URL is itself a page of the crawl. If the target was never crawled (nothing links to it, including a query-only redirect), the requested row is the only copy of that content and is evaluated, so a real duplicate is not hidden. The streaming engine builds the crawled set from one light pass over getPagesWithoutBodies and extractPageFeatures blanks title and description only for such rows; the legacy loops of content/duplicate-title, content/duplicate-description and core/title-unique do the same.
  3. Docs: docs/configuration/crawler.mdx (headers: the default, how to set one, the duplicate behaviour). CHANGELOG under Unreleased (Changed and Fixed).

Tests (failing first)

  • apps/cli/tests/cli/audit-accept-language-1355-e2e.test.ts: real CLI against a shop-like server whose /de-ch and /fr-ch redirect to /en only when the request has Accept-Language. Default: no request carries it, the locale paths are crawled as their own pages, no duplicate-title or duplicate-description finding. With [crawler] headers = { "Accept-Language" = "en-US" }: every crawl request to /de-ch, /fr-ch, /en carries it, and the three redirecting URLs are not duplicates of /en. Both fail on main.
  • packages/rules/tests/redirected-pages-not-duplicates-1355.test.ts: the helper (canonicalisation both sides, uncrawled target, query-only redirect), and the three rules (redirected urls to a crawled target are not duplicates; two real pages with the same text still are; a redirect to an uncrawled target does not hide a duplicate).
  • e2e: a second shop where /a2 redirects to a never-linked /b2 and /c2 repeats its text: the duplicate is reported (fails on the first version of this PR).
  • Gates: tsgo in utils, rules, audit-engine, crawler and apps/cli; apps/cli format and lint; crawler cache/header/robots/sitemap tests, page-features-noindex-golden; make validate.

Hosted audits

The cloud crawler uses packages/crawler, so it inherits the change when the private gitlink is bumped; cloud browser renders use the browser's own language and are unaffected. The private apps/link-check-worker (check-url.ts, perch_tier2/fetch.py) has its own Accept-Language: en-US,en;q=0.9 for link status checks: that is a separate fetcher, so a small private follow-up should decide whether it drops the header too. Cached prior-crawl entries in packages/cloud-audit-runtime that were keyed on accept-language: en will simply miss once.

Skill (squirrelscan/skills): no change needed.

Docs also say: the browser User-Agent now arrives with no language (a strict bot filter may notice), and a cloud browser render uses the browser's language while the plain fetch beside it sends none. Rebased on main.

nc9 added 2 commits October 31, 2026 06:26
…not duplicates of their target #1355

Signed-off-by: Nik Cubrilovic <[email protected]>
…arget is crawled; docs and changelog state the cache, fingerprint and render caveats #1355

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9

nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.145 as a44a6993 db6254ab via #1377. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.145. Closing this original.

nik

@nc9 nc9 closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crawler sends Accept-Language en-US by default; locale redirects make /de-ch and /fr-ch duplicates of /en

1 participant