Added separate docker compose for local testing
This commit is contained in:
13
app/main.py
13
app/main.py
@@ -1,5 +1,5 @@
|
||||
from fastapi import FastAPI, Request
|
||||
# from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from slowapi import _rate_limit_exceeded_handler
|
||||
from slowapi.errors import RateLimitExceeded
|
||||
|
||||
@@ -46,7 +46,16 @@ def create_application() -> FastAPI:
|
||||
logger.info(f"DEBUG: Status Code: {response.status_code}")
|
||||
return response
|
||||
|
||||
# Set up Rate Limiter (CORS is handled by Caddy at the edge)
|
||||
# Set up fully permissive CORS for standalone/tunnelling mode
|
||||
application.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Set up Rate Limiter
|
||||
application.state.limiter = limiter
|
||||
|
||||
@application.exception_handler(RateLimitExceeded)
|
||||
|
||||
Reference in New Issue
Block a user