Send custom headers to staging: feature flags, debug and routing
Many back ends switch behaviour on a request header: X-Feature-Flag: new-checkout enables an unreleased feature, X-Debug: 1 adds timing data, and a routing header sends you to a canary build. To send such headers from Chrome or Edge, create a HeaderDial profile for the environment, add the headers as request headers, and restrict the profile with an Only on domain filter. The headers then reach staging and nothing else.
Typical headers
| Header (example) | Typical use |
|---|---|
X-Feature-Flag: new-checkout,dark-mode | Force flags on for your requests without changing the flag service |
X-Debug: 1 | Ask the server for verbose logs, debug toolbars or timing headers |
X-Backend: canary or X-Env: pr-1234 | Have an ingress or gateway route you to a specific build or preview deployment |
X-Request-Id: qa-session-7 | Make your requests easy to find in logs and traces |
X-Api-Key: … | Get past a shared-key gate in front of a test environment |
These names are conventions, not standards. Use whatever your services read. The X- prefix is no longer recommended for new standard headers, but it is still common for private ones.
Steps
- Click the HeaderDial icon. If the banner asks for site access, choose Only <current host> while on staging, or Allow on all sites.
- Click + next to the profile chips to create a profile. Name it after the environment ("Staging", "Canary", "PR preview") and give it a colour. The toolbar badge takes the colour of the leftmost active profile, which is a handy reminder of where you are.
- Click + Request header for each header you need and fill in the name and value. Leave the operation on set.
- Open Where it applies, click + Only on…, choose Domain and enter the staging host, such as
staging.example.com. Domain filters include subdomains. For a pattern, use type URL pattern, for example||staging.example.com^, or URL regex to match preview hosts such as^https://pr-\d+\.preview\.example\.com/. - Repeat for other environments. Several profiles can be active at once; if two set the same header, the leftmost chip wins. Change the order with Move left (higher priority) in the ⋯ menu.
- Switch individual profiles with their Active switch, or everything at once with the global On/Paused switch at the top right.
Why the domain filter matters
Filters match the URL of each request, not the tab. Without an Only on filter the profile applies to every request: production, third-party scripts, analytics and fonts. That leaks internal flag names, and may break third-party APIs that reject unknown headers. A domain filter also keeps you from testing production with debug flags you forgot about. To exclude one host from a broader pattern, add a + Never on… row, for example for auth.staging.example.com.
Short sessions and one-off tests
- Pick an expiry in the row's expiry select (15 min, 1 hour, 8 hours or 1 day) for headers like
X-Debug. The row shows the time left, such as⏱ 47m left, and switches itself off afterwards. - Tick Only in this tab (until it closes) to keep a flag to one tab, so you can compare old and new behaviour side by side in two tabs.
Sharing a setup with your team
In the profile's ⋯ menu, Share as link… puts the whole profile into the link after the #, so nothing is uploaded anywhere. Tick Leave header values empty if the profile holds keys or tokens. Colleagues paste the link into Import… in the footer. Export this profile and Export all (headerdial-profiles.json) give you files you can commit to a repository next to your environment docs.
The curl equivalent
curl -H "X-Feature-Flag: new-checkout" -H "X-Debug: 1" https://staging.example.com/checkout
Pitfalls
X-Debug: 1. Debug output, flag overrides and routing headers must be ignored or stripped at the edge in production, or require authentication. Otherwise a visitor can switch on unfinished features or read internal data.- Caches and CDNs may serve a response produced without your flag. Make the server send
Varyfor the header, or bypass the cache on staging. - Proxies may strip unknown headers. Some load balancers and gateways drop or rename headers they don't recognise. If the application never sees your header, check its logs before blaming the browser.
- Check that it matched. The footer shows "Applied to N requests in this tab". If it stays at zero, check the filter value and site access.
Add to ChromeFirefox: coming soon