headertrace is a simple HTTP server echoing back HTTP client Headers in the response body.
It allows also to specify custom headers to be put in the HTTP reply.
It's main usage is to help debugging HTTP header transformations.
Installation
headertrace is built for different OS/architectures as a standalone binary (see the Download Binaries section).
Linux container images for both AMD64 and ARM64 architectures are also available
Jump to the Container Images section for more info.
Download Binaries
-
Visit the releases page and download the appropriate binary for your operating system and architecture:
-
Rename the downloaded binary to headertrace (or headertrace.exe on Windows):
mv headertrace-linux-amd64 headertrace
-
Make the binary executable (Linux/macOS only):
chmod +x headertrace
-
Optionally, move it to a directory in your PATH for easier access:
sudo mv headertrace /usr/local/bin/
Quickstart
Start the HTTP server (default TCP port is 8080):
headertrace
to listen on a particular IP address (or hostname) and TCP port use the -a and -p parameters:
headertrace -a 192.168.1.10 -p 1234
to add custom Headers in all HTTP server replies use the -H flag:
headertrace -H "X-Custom-HDR1:value,X-Custom-HDR2:value"
inline help:
headertrace -h
Container Images
Linux container images are available at Quay.io.
You can run the container images directly with podman or docker:
docker run quay.io/fgiudici/headertrace:latest
and pass the options as usual (see the Quickstart section).
A sample Kubernetes Deployment and an associated Service would look like:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: headertrace
name: headertrace
namespace: headertrace
spec:
replicas: 2
selector:
matchLabels:
app: headertrace
strategy: {}
template:
metadata:
labels:
app: headertrace
spec:
containers:
- image: quay.io/fgiudici/headertrace:latest
args: ["-H X-Served-By:Headertrace"]
name: headertrace
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
labels:
app: headertrace
name: headertrace
namespace: headertrace
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8080
selector:
app: headertrace
type: NodePort