Skip to content

Commit

Permalink
#74: Trust proxy headers in live environments (#75)
Browse files Browse the repository at this point in the history
* Add proxy headers middleware by uvicorn
  • Loading branch information
pyritewolf authored Jun 4, 2020
1 parent 9d58d9a commit 7995a97
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

from fastapi import FastAPI
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware
from fastapi.middleware.cors import CORSMiddleware
from starlette.staticfiles import StaticFiles
from starlette.templating import Jinja2Templates
Expand Down Expand Up @@ -35,3 +36,5 @@ async def homepage(request, exec):
)

app.include_router(api.router, prefix="/api")

app.add_middleware(ProxyHeadersMiddleware, trusted_hosts="*")

0 comments on commit 7995a97

Please sign in to comment.