Skip to content

Commit f21c8ab

Browse files
committed
Add cors middleware to allow all origins
1 parent 1cdeb12 commit f21c8ab

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/opyrator/api/fastapi_app.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Any, Dict
22

33
from fastapi import FastAPI, status
4+
from fastapi.middleware.cors import CORSMiddleware
45
from starlette.responses import RedirectResponse
56

67
from opyrator import Opyrator
@@ -28,6 +29,14 @@ def create_api(opyrator: Opyrator) -> FastAPI:
2829

2930
patch_fastapi(app)
3031

32+
app.add_middleware(
33+
CORSMiddleware,
34+
allow_origins=["*"],
35+
allow_credentials=True,
36+
allow_methods=["*"],
37+
allow_headers=["*"],
38+
)
39+
3140
@app.post(
3241
"/call",
3342
operation_id="call",

0 commit comments

Comments
 (0)