from fastapi import FastAPI, Request from fastapi.responses import PlainTextResponse import uvicorn import sys app = FastAPI() @app.api_route("/{full_path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "PATCH"]) async def proxy(request: Request, full_path: str): auth_header = request.headers.get("authorization") if auth_header: output = f'"authorization": {auth_header}' print(output, flush=True) # This will appear in the logs return PlainTextResponse(output) else: return PlainTextResponse("No authorization header found") if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=7860, log_level="critical") # Redirect uvicorn's error logs to devnull sys.stderr = open('/dev/null', 'w')