Skip to content

fix: avoid injected accept-language headless signal#542

Open
BoSuYxxxOfficial wants to merge 1 commit into
apify:masterfrom
BoSuYxxxOfficial:fix-headless-accept-language-header
Open

fix: avoid injected accept-language headless signal#542
BoSuYxxxOfficial wants to merge 1 commit into
apify:masterfrom
BoSuYxxxOfficial:fix-headless-accept-language-header

Conversation

@BoSuYxxxOfficial
Copy link
Copy Markdown

@BoSuYxxxOfficial BoSuYxxxOfficial commented May 12, 2026

Summary

  • filter accept-language out of fingerprint-injector extra HTTP headers
  • preserve generated language consistency for Playwright by passing fingerprint.navigator.language through the native locale context option
  • add focused regression coverage for both header filtering and newInjectedContext options

Why

Issue #178 tracks fingerprint injection making Chromium detectable by areyouheadless. The issue thread narrowed one reproducible cause to injecting generated accept-language as an extra header. Removing that header fixes the detection signal, while using Playwright locale keeps the browser context aligned with the generated navigator language instead of silently falling back to the default locale.

Verification

  • pnpm build
  • pnpm exec vitest run test/fingerprint-injector/fingerprint-injector.test.ts -t 'accept-language|native locale'
  • pnpm exec prettier packages/fingerprint-injector/src/fingerprint-injector.ts test/fingerprint-injector/fingerprint-injector.test.ts --check
  • pnpm lint (0 errors; existing warnings in unrelated JS files)
  • live areyouheadless checks returned You are not Chrome headless for:
    • Playwright headless Chromium using newInjectedContext
    • Playwright headful Chromium under xvfb-run using newInjectedContext
    • Puppeteer headless Chrome using newInjectedPage

Note

The local full browser test matrix cases that explicitly use channel: "chrome" could not be run because system Google Chrome is not installed at /opt/google/chrome/chrome, and pnpm exec playwright install chrome requires sudo in this environment.

Fixes #178

@algora-pbc /claim #178

Filter accept-language out of fingerprint-suite extra headers while preserving the generated language through Playwright's native locale option. This fixes the headless signal without leaving navigator locale injection inconsistent.

Constraint: keep the change narrow to fingerprint-injector header and locale behavior.

Rejected: adding a new ignoreHeaders option, because the maintainer explicitly preferred avoiding more granular options.

Confidence: high; unit tests and live areyouheadless checks pass for Playwright and Puppeteer.

Scope-risk: low-to-medium; affects default injected request header behavior for accept-language.

Directive: claim apify#178 bounty only after PR is opened and reviewed by maintainers/Algora.

Tested: pnpm build; pnpm exec vitest run test/fingerprint-injector/fingerprint-injector.test.ts -t 'accept-language|native locale'; pnpm exec prettier packages/fingerprint-injector/src/fingerprint-injector.ts test/fingerprint-injector/fingerprint-injector.test.ts --check; pnpm lint; live Playwright/Puppeteer areyouheadless checks.

Not-tested: full browser suite with channel: chrome, because system Google Chrome is not installed and installer requires sudo.
@BoSuYxxxOfficial BoSuYxxxOfficial changed the title Avoid injected accept-language headless signal fix: avoid injected accept-language headless signal May 12, 2026
@BoSuYxxxOfficial
Copy link
Copy Markdown
Author

@algora-pbc /claim #178

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.

fingerprint injection makes browsers detectable as headless

4 participants