feat: add trust proxy support for correct IP logging behind reverse proxies (v2.7.6)
- Add TRUST_PROXY environment variable to enable proxy header trust - Configure Express trust proxy in both HTTP server implementations - Fix issue #19: Docker internal IPs logged instead of real client IPs - Update documentation with reverse proxy configuration guide - Add examples for nginx proxy header forwarding - Maintain backward compatibility (disabled by default) When TRUST_PROXY=1 is set, the server will correctly log client IPs from X-Forwarded-For headers instead of proxy/container IPs. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,13 @@ export async function startFixedHTTPServer() {
|
||||
|
||||
const app = express();
|
||||
|
||||
// Configure trust proxy for correct IP logging behind reverse proxies
|
||||
const trustProxy = process.env.TRUST_PROXY ? Number(process.env.TRUST_PROXY) : 0;
|
||||
if (trustProxy > 0) {
|
||||
app.set('trust proxy', trustProxy);
|
||||
logger.info(`Trust proxy enabled with ${trustProxy} hop(s)`);
|
||||
}
|
||||
|
||||
// CRITICAL: Don't use any body parser - StreamableHTTPServerTransport needs raw stream
|
||||
|
||||
// Security headers
|
||||
|
||||
Reference in New Issue
Block a user