Commit 7d4bc719 authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

added flask-cors and used allow cross_allowed_origins to fix the issue seen on...

added flask-cors and used allow cross_allowed_origins to fix the issue seen on prod cluster (400 CORS error)
parent bb267e98
......@@ -7,6 +7,7 @@ import messages
# third-party imports
import uuid
from flask import Flask, redirect, url_for, request, render_template, flash, session, send_from_directory
from flask_cors import CORS
from flask_bootstrap import Bootstrap
import random
import os
......@@ -14,6 +15,7 @@ import json
def create_app(config_name):
app = Flask(__name__, static_folder='static') # initialization of the flask app
cors = CORS(app, resources={r"/*": {"origins": "https://testshib1.dev.rc.uab.edu/"}})
Bootstrap(app) # allowing app to use bootstrap
def get_authorized_user():
......
......@@ -7,6 +7,7 @@ Flask==1.1.1
Flask-Bootstrap==3.3.7.1
Flask-SocketIO==4.2.1
Flask-Testing==0.7.1
Flask-Cors==3.0.10
gevent==1.4.0
greenlet==0.4.15
importlib-metadata==1.5.0
......
......@@ -14,7 +14,7 @@ monkey.patch_all(subprocess=True)
config_name = os.getenv('FLASK_CONFIG')
app = create_app(config_name)
app.config['SECRET_KEY'] = vars.key
socketio = SocketIO(app, message_queue= vars.message_queue)
socketio = SocketIO(app, cors_allowed_origins="https://testshib1.dev.rc.uab.edu", message_queue=vars.message_queue)
@socketio.on('join_room')
def on_room(json):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment