Rayrun
← Back to Discord Forum

How to properly add extra header to all requests in playwright without running into CORS issue

hello, Our team is trying to add a specific header to all requests in our playwright tests. we tried using extraHttpHeader, but that leads to CORS issue. When we tried to disable web security, it leads to login issue with our auth service. How can we can go around this issue?

We tried using the chrome extension for "ModHeader" to test out this scenario and that didn't lead to any CORS issues, so we suspect it has to do with playwright or chromium itself.

This thread is trying to answer question "How can a specific header be added to all requests in playwright tests without encountering CORS or login issues?"

2 replies

i investigated further and it looks like playwright doesn't add the header we wanted to preflight request (OPTION) and only the normal request (POST, GET, ... ) thus leading to the cors issue. is there a way to fix this?

You can check this https://github.com/microsoft/playwright/issues/13527#issuecomment-1098364767 I didn’t see that options are not included or some cors issue when I change the header

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].