added middelware
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 33s

This commit is contained in:
2024-12-10 21:21:36 +01:00
parent 97e77d8b75
commit 16578726fe

4
app.py
View File

@@ -6,15 +6,15 @@ import json
import os import os
from starlette.middleware.httpsredirect import HTTPSRedirectMiddleware from starlette.middleware.httpsredirect import HTTPSRedirectMiddleware
from fastapi.middleware.trustedhost import TrustedHostMiddleware from fastapi.middleware.trustedhost import TrustedHostMiddleware
from starlette.middleware.proxy_headers import ProxyHeadersMiddleware
app = FastAPI() app = FastAPI()
# Mount static files # Mount static files
app.mount("/static", StaticFiles(directory="static"), name="static") app.mount("/static", StaticFiles(directory="static"), name="static")
app.add_middleware( HTTPSRedirectMiddleware ) app.add_middleware( HTTPSRedirectMiddleware )
app.add_middleware(ProxyHeadersMiddleware)
app.add_middleware(TrustedHostMiddleware, allowed_hosts=["*"]) app.add_middleware(TrustedHostMiddleware, allowed_hosts=["*"])