added regex filter for certain urls to CORS
This commit is contained in:
parent
98c6e9aac0
commit
bdae82dda6
|
|
@ -6,7 +6,6 @@ README.md
|
|||
git_push.sh
|
||||
openapi_server/__init__.py
|
||||
openapi_server/controllers/__init__.py
|
||||
openapi_server/controllers/patchnotes_controller.py
|
||||
openapi_server/controllers/security_controller.py
|
||||
openapi_server/models/__init__.py
|
||||
openapi_server/models/patch_notes.py
|
||||
|
|
|
|||
|
|
@ -8,8 +8,12 @@ from flask import Flask
|
|||
from openapi_server import encoder
|
||||
from pymongo import MongoClient
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
import re
|
||||
|
||||
|
||||
kanzleiapp_urls = "[a-zA-Z0-9.-]+\.kanzleiapp\.io"
|
||||
masasana_urls = r"[a-zA-Z0-9.-]+\.masasana\.ai"
|
||||
|
||||
client = MongoClient(host='mongodb://admin:admin@announcement-service-database-svc:27017/?authSource=admin')
|
||||
db = client["MainDB"]
|
||||
collection = db['patch_notes']
|
||||
|
|
@ -19,7 +23,7 @@ app = connexion.FlaskApp(__name__, specification_dir='./openapi/')
|
|||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
position=MiddlewarePosition.BEFORE_EXCEPTION,
|
||||
allow_origins=["http://localhost:4200"],
|
||||
allow_origins=["http://localhost:4200", kanzleiapp_urls, masasana_urls],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
python_dateutil >= 2.5.3
|
||||
setuptools >= 21.0.0
|
||||
urllib3 >= 2.2.2, < 2.3.0
|
||||
pydantic >= 2
|
||||
typing-extensions >= 4.7.1
|
||||
Flask >= 3.1.0
|
||||
Flask-PyMongo >= 3.0.1
|
||||
pymongo >= 4.11.3
|
||||
connexion[swagger-ui, flask] >= 3.2.0
|
||||
werkzeug == 3.1.3
|
||||
connexion[swagger-ui] >= 2.6.0; python_version>="3.6"
|
||||
# 2.3 is the last version that supports python 3.4-3.5
|
||||
connexion[swagger-ui] <= 2.3.0; python_version=="3.5" or python_version=="3.4"
|
||||
# prevent breaking dependencies from advent of connexion>=3.0
|
||||
connexion[swagger-ui] <= 2.14.2; python_version>"3.4"
|
||||
# connexion requires werkzeug but connexion < 2.4.0 does not install werkzeug
|
||||
# we must peg werkzeug versions below to fix connexion
|
||||
# https://github.com/zalando/connexion/pull/1044
|
||||
werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4"
|
||||
swagger-ui-bundle >= 0.0.2
|
||||
uvicorn >= 0.21.1
|
||||
typing_extensions~=4.12.2
|
||||
flask_cors >= 5.0.1
|
||||
python_dateutil >= 2.6.0
|
||||
setuptools >= 21.0.0
|
||||
Flask == 2.1.1
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@ typing_extensions~=4.12.2
|
|||
flask_cors >= 5.0.1
|
||||
typing_extensions==4.12.2
|
||||
Flask-Testing==0.8.1
|
||||
starlette==0.46.1
|
||||
starlette==0.46.1
|
||||
|
|
|
|||
Loading…
Reference in New Issue