generated from hjess/PythonTemplateProject
added middelware
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 33s
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 33s
This commit is contained in:
4
app.py
4
app.py
@@ -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=["*"])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user