summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/web.py
diff options
context:
space:
mode:
Diffstat (limited to 'fatcat_scholar/web.py')
-rw-r--r--fatcat_scholar/web.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py
index 31ee617..8a1faa7 100644
--- a/fatcat_scholar/web.py
+++ b/fatcat_scholar/web.py
@@ -13,6 +13,7 @@ import babel.support
from fastapi import FastAPI, APIRouter, Request, Depends, Response, HTTPException
from fastapi.staticfiles import StaticFiles
from fastapi.responses import PlainTextResponse, JSONResponse, FileResponse
+from fastapi.middleware.cors import CORSMiddleware
import sentry_sdk
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
from starlette_prometheus import metrics, PrometheusMiddleware
@@ -322,6 +323,14 @@ async def http_exception_handler(request: Request, exc: StarletteHTTPException)
# configure middleware
+app.add_middleware(
+ CORSMiddleware,
+ allow_origins=["*"],
+ allow_credentials=False,
+ allow_methods=["GET"],
+ allow_headers=[], # some defaults always enabled
+)
+
if settings.SENTRY_DSN:
logger.info("Sentry integration enabled")
sentry_sdk.init(