HeaderDial › Guides

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-modeForce flags on for your requests without changing the flag service
X-Debug: 1Ask the server for verbose logs, debug toolbars or timing headers
X-Backend: canary or X-Env: pr-1234Have an ingress or gateway route you to a specific build or preview deployment
X-Request-Id: qa-session-7Make 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

  1. Click the HeaderDial icon. If the banner asks for site access, choose Only <current host> while on staging, or Allow on all sites.
  2. 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.
  3. Click + Request header for each header you need and fill in the name and value. Leave the operation on set.
  4. 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/.
  5. 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.
  6. 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

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

Never trust these headers from the internet. Anyone can send 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.

Add to ChromeFirefox: coming soon