Proxy config

This commit is contained in:
2026-07-27 02:47:00 -07:00
parent c0c3a4c405
commit f423764645
3 changed files with 13 additions and 6 deletions
+7 -2
View File
@@ -56,6 +56,10 @@ async def messages_endpoint(request):
if not sid or sid not in mcp_logic.sessions:
return Response("Session not found", status_code=404)
# Capture the host header to ensure image links work across the network
host_header = request.headers.get("host", f"{config.HOST}:{config.PORT}")
config.request_host.set(host_header)
try:
body = await request.json()
except Exception as e:
@@ -116,7 +120,8 @@ app.add_middleware(
)
if __name__ == "__main__":
config = uvicorn.Config(
# Use a separate variable for uvicorn config to avoid shadowing the config module
uvicorn_config = uvicorn.Config(
app=app,
host=config.HOST,
port=config.PORT,
@@ -124,7 +129,7 @@ if __name__ == "__main__":
timeout_graceful_shutdown=2 # Reduced from 5 to 2 seconds
)
server = uvicorn.Server(config)
server = uvicorn.Server(uvicorn_config)
def signal_handler(sig, frame):
logger.info("Shutdown signal received")