e1250 commited on
Commit
9a7d942
·
1 Parent(s): 2bd9d9e

fix: add server middleware

Browse files
Files changed (1) hide show
  1. main.py +6 -0
main.py CHANGED
@@ -15,6 +15,7 @@ import mlflow
15
  import torch
16
  from huggingface_hub import hf_hub_download
17
  import redis.asyncio as aioredis
 
18
 
19
 
20
  @asynccontextmanager
@@ -74,6 +75,11 @@ app = FastAPI(
74
  lifespan=lifespan
75
  )
76
 
 
 
 
 
 
77
  # Routes
78
  app.mount("/metrics", metrics_asgi_app) # Starting Prometheus server attached to my server.
79
  app.include_router(camera_stream.router, prefix="/detectors")
 
15
  import torch
16
  from huggingface_hub import hf_hub_download
17
  import redis.asyncio as aioredis
18
+ from fastapi.middleware.trustedhost import TrustedHostMiddleware
19
 
20
 
21
  @asynccontextmanager
 
75
  lifespan=lifespan
76
  )
77
 
78
+ app.add_middleware(
79
+ TrustedHostMiddleware,
80
+ allowed_hosts=["*"]
81
+ )
82
+
83
  # Routes
84
  app.mount("/metrics", metrics_asgi_app) # Starting Prometheus server attached to my server.
85
  app.include_router(camera_stream.router, prefix="/detectors")