Skip to content
Snippets Groups Projects
Commit 85c94f95 authored by Christian Boettcher's avatar Christian Boettcher
Browse files

add cors to python backend

parent 7a64ed6a
Branches
Tags
No related merge requests found
Pipeline #94996 passed
...@@ -12,6 +12,7 @@ from fastapi import FastAPI, HTTPException, Request, status ...@@ -12,6 +12,7 @@ from fastapi import FastAPI, HTTPException, Request, status
from fastapi.param_functions import Depends from fastapi.param_functions import Depends
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from fastapi.middleware.cors import CORSMiddleware
from pydantic import UUID4 from pydantic import UUID4
from starlette.responses import RedirectResponse from starlette.responses import RedirectResponse
...@@ -40,6 +41,24 @@ app = FastAPI( ...@@ -40,6 +41,24 @@ app = FastAPI(
title="API-Server for the Data Catalog" title="API-Server for the Data Catalog"
) )
origins = [
"https://datacatalog.fz-juelich.de",
"https://datacatalogue.eflows4hpc.eu",
"https://zam10059.zam.kfa-juelich.de",
"https://zam10036.zam.kfa-juelich.de",
"http://datacatalog.fz-juelich.de",
"http://datacatalogue.eflows4hpc.eu",
"http://zam10059.zam.kfa-juelich.de",
"http://zam10036.zam.kfa-juelich.de"
]
app.add_middleware(CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)
# if env variable is set, get config .env filepath from it, else use default # if env variable is set, get config .env filepath from it, else use default
dotenv_file_path = os.getenv(DOTENV_FILE_PATH_VARNAME, DOTENV_FILE_PATH_DEFAULT) dotenv_file_path = os.getenv(DOTENV_FILE_PATH_VARNAME, DOTENV_FILE_PATH_DEFAULT)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment