Skip to content

Commit e35ad73

Browse files
fix: Add ProxyHeadersMiddleware middleware
1 parent 07a74bd commit e35ad73

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from fastapi.middleware.cors import CORSMiddleware
99
from fastapi.responses import JSONResponse
1010
from fastapi.routing import APIRoute
11+
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware
1112

1213
from app.utils.logger import get_logger
1314
from config import ALLOWED_ORIGINS, DOCS, SUBSCRIPTION_PATH
@@ -77,6 +78,9 @@ async def lifespan(app: FastAPI):
7778
allow_methods=["*"],
7879
allow_headers=["*"],
7980
)
81+
82+
app.add_middleware(ProxyHeadersMiddleware, trusted_hosts="*")
83+
8084
from app import routers, telegram, jobs # noqa
8185
from app.routers import api_router # noqa
8286

0 commit comments

Comments
 (0)