Repository navigation
Send cookies and headers to your site - #12
Merged
Merged
Conversation
For pinning an A/B variant, turning on a feature flag, or getting past a preview deployment's protection. - `cookies` and `headers` in the config, each a map of names to values. A value that isn't text (usually an unset environment variable) stops with the cookie or header it belongs to. Both need an http(s) baseUrl. - Cookies are set for the host in baseUrl. Headers go through a route that only matches baseUrl's origin, not `extraHTTPHeaders`, so fonts, analytics and other hosts never get them. - Reading the sitemap sends them too. - README: a "Cookies and headers" section, config rows, `--config` in the command list, and a session cookie as the way onto signed-in pages.
Merged
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.
Why
wrapguard sees whatever the server hands it. A site running an A/B test can serve a different variant to the baseline run and the PR check, and a preview deployment behind protection, or a page behind a sign-in, can't be reached at all. Someone asked about exactly this on the launch thread.
What
`cookies.session` must be text, not undefined), which is what an unset environment variable in a JS config looks like. Both need anhttp(s)baseUrl.baseUrl. Headers go through acontext.routethat only matchesbaseUrl's origin, rather thanextraHTTPHeaders, which would send them to fonts, analytics and every other host. Headers can hold a token.--configin the command list, and the sign-in limit now points at a session cookie.Trade-off: Playwright turns off its HTTP cache while a route is set, so runs with
headersmay be a little slower. Runs without them are unchanged.Checked
test/site.test.ts, against two local servers:variant b,cookie hero-test=b){}and rejects a non-text value, a list, and afile://baseUrltsc --noEmitcleanNot released. This would go out as 0.3.0 (new config options).