If the user is specifically looking for the NPM package reflect-proxy, version 4 introduced middleware support for altering the reflection.
npm install -g reflect-proxy@4
Configuration file (reflect.config.json):
"version": 4,
"port": 8080,
"mode": "echo",
"reflection":
"addHeaders": true,
"stripAuth": false,
"maxBodySize": "10mb"
Run the server:
reflect-proxy --config reflect.config.json
Testing it:
curl -X POST http://localhost:8080/api/test \
-H "Content-Type: application/json" \
-H "X-Debug-Token: mySecret" \
-d '"hello":"world"'
Expected Output (Reflected):
"originalMethod": "POST",
"originalPath": "/api/test",
"originalHeaders":
"content-type": "application/json",
"x-debug-token": "mySecret",
"host": "localhost:8080"
,
"originalBody":
"hello": "world"
,
"timestamp": "2025-01-27T12:00:00Z"
Version 4 standards often require adding tracing headers to see the round trip. Inject X-Reflected-By and X-Reflect-ID.
proxy.on('proxyReq', (proxyReq, req, res) =>
proxyReq.setHeader('X-Reflected-By', 'reflect-proxy-4');
proxyReq.setHeader('X-Reflect-ID', `$Date.now()-$Math.random()`);
);
Let’s break down the key components you’ll interact with when using reflect 4 proxy. reflect 4 proxy
Example IP allow:
listeners:
- name: admin
address: 0.0.0.0
port: 9443
protocol: https
allowed_ips:
- 203.0.113.0/24
For this guide, we will build a conceptual Reflect Proxy v4. Version 4 implies non-blocking I/O (Event loop friendly), support for HTTP/2, and TLS reflection capabilities. If the user is specifically looking for the
The implementation of a Reflection 4 Proxy architecture offers several distinct benefits over legacy forward/reverse proxy setups: