Skip to content

fix(playwright): update context.request.headers with actual playwright headers - #2209

Draft
RohithPariki wants to merge 1 commit into
apify:masterfrom
RohithPariki:auto-fix-1055
Draft

fix(playwright): update context.request.headers with actual playwright headers#2209
RohithPariki wants to merge 1 commit into
apify:masterfrom
RohithPariki:auto-fix-1055

Conversation

@RohithPariki

Copy link
Copy Markdown

Problem

Request headers when using fingerprint generator or header generator are not saved in context.request.headers.

Root Cause

When browserforge injects headers, they bypass the Crawlee-level request headers list. Because the framework does not sync back the actual headers used by Playwright for the navigation, the context remains unaware of them.

Solution

Updated _playwright_crawler.py to retrieve the actual headers from Playwright's response.request and update the Crawlee context.request.headers after navigation.

Testing

Manual verification / static analysis. (Verified that actual Playwright headers are parsed into HttpHeaders).

Risk

Low risk. Modifies the state of context.request.headers after navigation, which ensures consistency with what was actually sent over the wire.

Issue

Closes #1055

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.

bug: Request headers when using fingerprint generator or header generator are not saved in context.request.headers

2 participants