2.9 KiB
Header Tagger
Zoraxy plugin — Copy custom headers from a source domain to every other domain sharing the same tag.
The Problem
Zoraxy forwards X-Forwarded-For, X-Real-IP, X-Forwarded-Proto, and X-Forwarded-Host natively, but when you want a custom header on many domains (e.g. X-Original-Client-IP = $remote_addr, or a security header), you'd normally set it manually on every domain — one by one.
The Solution
Define the header once on a source domain, tag it, then let this plugin copy it to all other domains sharing the tag.
Tag "tracking":
├── app.example.com ← manually set X-Original-Client-IP = $remote_addr (SOURCE)
├── api.example.com ← plugin copies the header here
└── cdn.example.com ← and here
Usage
- In Zoraxy, edit a domain → Advanced Settings → Custom Headers → add your headers.
- Tag that domain (e.g.
tracking). - Tag the other domains with the same tag.
- Open the plugin at
/plugin.ui/zoraxy-headers/. - Click Apply to selected — the plugin copies the source's headers to the selected targets.
Use Remove from selected to strip those headers from targets.
Supported Dynamic Header Values
Zoraxy v3.1.2+ supports nginx-style $variable placeholders in request-direction header values:
| Placeholder | Meaning |
|---|---|
$remote_addr |
Client IP |
$host |
Original host |
$scheme |
http / https |
$request_uri |
Full request URI |
$request_method |
GET / POST / ... |
$http_user_agent |
User-Agent |
$http_referer |
Referer |
Example — preserve the original client IP in a custom header:
Header: X-Original-Client-IP = $remote_addr (request direction)
Install
curl -sSL https://git.lohmar.co.uk/cclohmar/zoraxy-headers/raw/branch/main/install.sh | sudo bash
Or manually:
git clone https://git.lohmar.co.uk/cclohmar/zoraxy-headers.git /opt/zoraxy/plugins/zoraxy-headers
cd /opt/zoraxy/plugins/zoraxy-headers
go build -buildvcs=false -o zoraxy-headers .
systemctl restart zoraxy
Then enable Header Tagger in Zoraxy → Plugins.
How It Works
The plugin uses Zoraxy's plugin API key (scoped to proxy list + header endpoints) to:
GET /api/proxy/list?type=host→ all domains and their tags- Group domains by tag, identify the "source" (a domain that already has headers)
POST /api/proxy/header/add/remove→ copy the source's headers to targets
No root access needed — the API key is scoped to only the required endpoints.
API Endpoints (plugin UI)
| Method | Path | Purpose |
|---|---|---|
GET |
/ui/api/groups |
List tags → domains → source |
POST |
/ui/api/apply |
Copy source headers to targets |
POST |
/ui/api/remove |
Remove headers from targets |
Requirements
- Zoraxy v3.2.0+
- Go 1.21+ (to build)
License
Zoraxy plugin SDK is LGPL. This plugin is open source.