fix(renderer): send modern UA on CDP path (setUserAgentOverride)#184
Merged
Conversation
JS-rendered scrapes went through the CDP renderer (lightpanda/chrome), which sent the browser's own — often stale — User-Agent. UA-gating sites then showed "your browser is outdated", even after #176 (that only fixed the HTTP-only fetcher). Thread the same effective_ua into CdpRenderer and apply it via Network.setUserAgentOverride in fetch_inner: session-scoped (no pool leak), after Network.enable / before navigate, best-effort (.ok() so lightpanda not supporting the method can't abort a render). HTTP and CDP now present the same UA. All four renderer tiers (lightpanda/playwright/chrome/chrome_proxy) covered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JS-rendered scrapes used the renderer's stale default UA → "browser outdated" gates (reported live). #176 only fixed HTTP-only. This applies the same effective_ua over CDP via Network.setUserAgentOverride in fetch_inner — session-scoped, after Network.enable/before navigate, best-effort (.ok() so lightpanda can't abort a render). All 4 tiers covered. Plan→3x review→implement→2x code-review→revise. clippy+208 tests green (cdp feature). Ships in v0.18.2.