v1.7.0 — PRESTAFLOW_EXTRA_HEADERS (WAF bypass, request tracing, edge headers)
Feature
-
PRESTAFLOW_EXTRA_HEADERS(#55) — new env var to attach arbitrary HTTP headers to every browser request, inherited by each page (including those recreated viagoToPage()/recreatePage()).PRESTAFLOW_EXTRA_HEADERS='{"X-CI-Bypass":"secret","X-Request-Id":"abc"}'Same solid application path as
presetBasicAuth():setConnectionHttpHeaders()at the browser level plusapplyExtraHttpHeaders()on the current page.
Use cases
- WAF / CDN bypass (the actual trigger): Cloudflare WAF Skip rule via
X-CI-Bypass: <shared_secret>, without hardcoding the dynamic IP of the CI runners. - Request tracing:
X-Request-Id: <ci-run-id>,X-CI-Run: <build>. - Edge functions: Netlify, Vercel, preview modes.
- Server-side feature flags:
X-Feature-Flag: preview-mode-2. - Other WAF/CDN than Cloudflare: Fastly, Sucuri, StackPath.
Robustness
- Env absent / empty string → silent no-op.
- Invalid JSON → warning on stderr, execution continues.
- Non-scalar values (array/null/object) ignored.
- Booleans/integers cast to string.
- Merge gives priority to env values → deliberate override of an already-set header (e.g.
Authorization) is possible.
Tests
8 unit tests (new file tests/Unit/Tests/ExtraHeadersFromEnvTest.php).
Upgrade
No breaking change. composer update prestaflow/php-library:^1.7 (or dev-main).