quentinL52 commited on
Commit ·
8912e47
1
Parent(s): e85b9e6
Fix: Enable redirect_slashes to fix 405 error in production
Browse files
main.py
CHANGED
|
@@ -21,11 +21,11 @@ app = FastAPI(
|
|
| 21 |
redoc_url="/redoc"
|
| 22 |
)
|
| 23 |
|
| 24 |
-
ALLOWED_ORIGINS = os.getenv("CORS_ORIGINS", "
|
| 25 |
|
| 26 |
app.add_middleware(
|
| 27 |
CORSMiddleware,
|
| 28 |
-
allow_origins=
|
| 29 |
allow_credentials=True,
|
| 30 |
allow_methods=["*"],
|
| 31 |
allow_headers=["*"],
|
|
@@ -69,5 +69,5 @@ async def simulate_interview(request: Request):
|
|
| 69 |
|
| 70 |
if __name__ == "__main__":
|
| 71 |
import uvicorn
|
| 72 |
-
port = int(os.getenv("PORT",
|
| 73 |
uvicorn.run(app, host="0.0.0.0", port=port)
|
|
|
|
| 21 |
redoc_url="/redoc"
|
| 22 |
)
|
| 23 |
|
| 24 |
+
ALLOWED_ORIGINS = os.getenv("CORS_ORIGINS", "*").split(",") if os.getenv("CORS_ORIGINS") != "*" else ["*"]
|
| 25 |
|
| 26 |
app.add_middleware(
|
| 27 |
CORSMiddleware,
|
| 28 |
+
allow_origins=["*"],
|
| 29 |
allow_credentials=True,
|
| 30 |
allow_methods=["*"],
|
| 31 |
allow_headers=["*"],
|
|
|
|
| 69 |
|
| 70 |
if __name__ == "__main__":
|
| 71 |
import uvicorn
|
| 72 |
+
port = int(os.getenv("PORT", 7860))
|
| 73 |
uvicorn.run(app, host="0.0.0.0", port=port)
|