microsoft / microsoft/playwright

[Feature] Directly set Proxy-Authorization in Chrome without configuring any other proxy settings

Open
#11,967 11 comments 65 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3-collecting-feedback
Dominant language
TypeScript
Stars
96.3k
Forks
6.5k
Avg merge
1d 6h
Merged PRs (30d)
180

Description

Google Cloud Platform has a feature called Identity Aware Proxy (IAP) that facilitates authentication to back-end cloud services. It's basically a reverse proxy that enforces authentication and applies security policies so the back-end services can just assume that all requests they receive are authorized.

If you need to access an IAP-secured service from inside Google Cloud this authentication happens automatically, but if you need to access an IAP service from outside, it is necessary to supply authentication credentials via headers. This can be done via the Authorization header, but in some cases (if your back-end app also uses Authorization) it is necessary to pass these credentials via the Proxy-Authorization header as a bearer token (not basic auth).

The problem (in Chrome/Chromium anyway) is that Proxy-Authorization may not be set explicitly via extraHTTPHeaders. If you do this and then try to navigate to any page Chrome will give you the following error: net::ERR_INVALID_ARGUMENT. If you configure a proxy this header will be automatically generated, but that won't work in this case because we don't actually want to configure any proxy (there is no applicable proxy address), and we want to use bearer rather than basic auth. I realize that this is a Chrome-specific issue and not directly under PlayWright's control, but I thought I would open an issue anyway to provide a real world example when setting this header is required and to discuss possible solutions or workarounds.

Related issue: https://github.com/microsoft/playwright-python/issues/443

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how extraHTTPHeaders handles Proxy-Authorization during Chromium navigation, then compare the related Playwright Python issue 443. Done means a bearer Proxy-Authorization header can be set without configuring a proxy and navigation no longer returns net::ERR_INVALID_ARGUMENT.

Written by the indexing model from the issue text.

Assessment

Tech stack
gcp
Domain
security, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.