Problem Description
The Langfuse Model Context Protocol (MCP) Server validates incoming connections by inspecting the HTTP Host header against allowed host configurations.
However, in many production cloud environments (such as AWS ALB, Cloudflare, Traefik, Nginx reverse proxies, or Kubernetes Ingresses), the original Host header is modified or replaced with the internal service name/IP address when forwarding traffic to the upstream container. Instead, standard proxy architectures relay the original client host in the X-Forwarded-Host header.
Because the MCP server currently relies solely on the Host header:
- Requests passing through reverse proxies/ingress controllers fail host verification.
- Operators are forced to alter standard proxy rules or hardcode host rewrites, which goes against best practices for many cloud infrastructure providers.
Proposed Solution
Update the MCP Server's request verification logic to respect proxy headers:
- Fallback/Fallback order: Inspect
X-Forwarded-Host prior to or as a fallback to Host (e.g., req.headers['x-forwarded-host'] || req.headers['host']).
- (Optional / Recommended) Trust Proxy Setting: If applicable (e.g., Express/Fastify backends), expose or respect standard
TRUST_PROXY / proxy settings so header spoofing risks are mitigated when behind trusted reverse proxies.
Additional Context & Standard References
- RFC 7239 / De-facto Standard:
X-Forwarded-Host is the widely accepted standard header for identifying the original host requested by the client in HTTP proxying.
- Impact: Affects users deploying MCP servers in Kubernetes, AWS ECS/EKS behind ALBs, or behind Cloudflare/Traefik API gateways.
Problem Description
The Langfuse Model Context Protocol (MCP) Server validates incoming connections by inspecting the HTTP
Hostheader against allowed host configurations.However, in many production cloud environments (such as AWS ALB, Cloudflare, Traefik, Nginx reverse proxies, or Kubernetes Ingresses), the original
Hostheader is modified or replaced with the internal service name/IP address when forwarding traffic to the upstream container. Instead, standard proxy architectures relay the original client host in theX-Forwarded-Hostheader.Because the MCP server currently relies solely on the
Hostheader:Proposed Solution
Update the MCP Server's request verification logic to respect proxy headers:
X-Forwarded-Hostprior to or as a fallback toHost(e.g.,req.headers['x-forwarded-host'] || req.headers['host']).TRUST_PROXY/ proxy settings so header spoofing risks are mitigated when behind trusted reverse proxies.Additional Context & Standard References
X-Forwarded-Hostis the widely accepted standard header for identifying the original host requested by the client in HTTP proxying.