From 72918ab6e6e2419388b8c5372512831a0a7c8c3a Mon Sep 17 00:00:00 2001 From: Rmarieta Date: Tue, 23 Jan 2024 15:08:21 +0100 Subject: [PATCH] Easing CORS on socketio to let localhost JS client connect --- flask/app/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/flask/app/__init__.py b/flask/app/__init__.py index 3722c7c..1388659 100644 --- a/flask/app/__init__.py +++ b/flask/app/__init__.py @@ -11,9 +11,7 @@ def create_app(): app = Flask(__name__) - cors = CORS(app, resources={ - r"/*": {"origins": []} - }) + cors = CORS(app, origins='*') app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg://{username}:{password}@{host}:{port}/{database}'.format( username=os.environ['RDS_USERNAME'], @@ -25,7 +23,7 @@ def create_app(): app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] db.init_app(app) - socketio.init_app(app, message_queue=os.environ.get('REDIS_MESSAGE_QUEUE_URL')) + socketio.init_app(app, cors_allowed_origins='*', message_queue=os.environ.get('REDIS_MESSAGE_QUEUE_URL')) # importing and registering routes with their url prefix from .views.main import main_bp