Proxy config
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user