Zoraxy plugin: copy custom headers from a source domain to tagged domains
Find a file
2026-10-14 14:21:35 +00:00
web feat: initial commit of Header Tagger plugin 2026-10-14 13:51:59 +00:00
zoraxy_plugin feat: initial commit of Header Tagger plugin 2026-10-14 13:51:59 +00:00
.gitignore feat: initial commit of Header Tagger plugin 2026-10-14 13:51:59 +00:00
go.mod feat: initial commit of Header Tagger plugin 2026-10-14 13:51:59 +00:00
install.sh feat: initial commit of Header Tagger plugin 2026-10-14 13:51:59 +00:00
main.go fix: use /plugin/ prefix for Zoraxy plugin API endpoints (declared + called) 2026-10-14 14:21:35 +00:00
models.go feat: initial commit of Header Tagger plugin 2026-10-14 13:51:59 +00:00
README.md feat: initial commit of Header Tagger plugin 2026-10-14 13:51:59 +00:00
server.go fix: use /plugin/ prefix for Zoraxy plugin API endpoints (declared + called) 2026-10-14 14:21:35 +00:00

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

  1. In Zoraxy, edit a domain → Advanced Settings → Custom Headers → add your headers.
  2. Tag that domain (e.g. tracking).
  3. Tag the other domains with the same tag.
  4. Open the plugin at /plugin.ui/zoraxy-headers/.
  5. 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:

  1. GET /api/proxy/list?type=host → all domains and their tags
  2. Group domains by tag, identify the "source" (a domain that already has headers)
  3. 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.