Skip to content

Commit c7c5630

Browse files
committed
Fix uvicorn proxy headers for k8s ingress
1 parent 15da29f commit c7c5630

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

server.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,10 @@ def query(sql_query: str) -> str:
9797
# Streamable HTTP uses a single endpoint (default: /mcp)
9898
# It supports both GET (handshake) and POST (messages) on the same URL.
9999
app = mcp.streamable_http_app()
100-
uvicorn.run(app, host="0.0.0.0", port=8000)
100+
uvicorn.run(
101+
app,
102+
host="0.0.0.0",
103+
port=8000,
104+
proxy_headers=True, # Trust X-Forwarded-* headers from proxy
105+
forwarded_allow_ips="*" # Allow any proxy IP (we're behind k8s ingress)
106+
)

0 commit comments

Comments
 (0)