add CORS headers to responses

This commit is contained in:
Christoph Stenglein 2021-10-04 17:30:01 +02:00
parent a8355687d4
commit c7cd337bf8
No known key found for this signature in database
GPG key ID: 43DF8DE289F09EDE

View file

@ -20,6 +20,7 @@ from app.repositories.lightning import register_lightning_listener
from app.repositories.system import register_hardware_info_gatherer
from app.routers import apps, bitcoin, lightning, setup, system
from app.sse_starlette import EventSourceResponse
from starlette.middleware.cors import CORSMiddleware
@registered_configuration
@ -44,6 +45,14 @@ app = VersionedFastAPI(
enable_latest=True,
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.on_event("startup")
async def on_startup():