From 0ad3a73c779ecdf4930818a8b6157475ce53b7e1 Mon Sep 17 00:00:00 2001 From: Jeremy Fee <jmfee@usgs.gov> Date: Mon, 20 Apr 2020 17:02:46 -0600 Subject: [PATCH] Add cors to data service --- geomagio/api/ws/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/geomagio/api/ws/app.py b/geomagio/api/ws/app.py index 279e21229..63819226e 100644 --- a/geomagio/api/ws/app.py +++ b/geomagio/api/ws/app.py @@ -2,6 +2,7 @@ from typing import Dict, Union from fastapi import FastAPI, Request, Response from fastapi.exceptions import RequestValidationError +from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse, PlainTextResponse, RedirectResponse from obspy import UTCDateTime @@ -22,6 +23,9 @@ VERSION = "version" app = FastAPI(docs_url="/docs", openapi_prefix="/ws") + +app.add_middleware(CORSMiddleware, allow_origins=["*"], max_age=86400) + app.include_router(data.router) app.include_router(elements.router) app.include_router(observatories.router) -- GitLab