Request ModifyInject Headers• 4 min read

How to Inject Custom Request Headers and Bearer Tokens

Summary: Add, replace, or strip HTTP request headers automatically. Ideal for injecting test JWT credentials, multi-tenant headers, or feature flags.

Why This Rule Matters for Developers & QA

Testing multi-tenant microservices or switching between developer tokens manually is error-prone. Header injection lets you enforce headers automatically across all requests matching a pattern.

Step-by-Step Implementation Guide

1

Set Target Request URL

Match your API gateway or microservice domain pattern (e.g. `https://gateway.internal.net/*`).

2

Configure Header Key-Value Pairs

Add headers such as `Authorization: Bearer <TOKEN>` or `X-Tenant-ID: staging-corp`.

3

Inspect Live Network Calls

Open ProxyCeptor Network tab to confirm that the outgoing calls have your injected headers attached.

Configuration Snippet

How to Inject Custom Request Headers and Bearer Tokens — proxyceptor-rule.json
JSON
{
"id": "rule_auth_bearer_injection",
"pattern": "https://gateway.internal.net/*",
"action": "modify-request-headers",
"requestHeaders": {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"X-Client-Platform": "SmartTV-Tizen-QA"
},
"enabled": true
}

Frequently Asked Questions

Explore More Debugging Guides

Redirect / Rewrite
URL Modify & Redirect
4 min read
JSON Deep Merge
Payload Modify & Deep Merge
5 min read
Full Mock Body
Response Replace & Mock Body
5 min read