From 7decd47997283021ff1e9f978200cbe90f4edd24 Mon Sep 17 00:00:00 2001 From: Ella Rohm-Ensing Date: Wed, 25 Sep 2019 17:48:34 +0200 Subject: [PATCH] add cors config to app without api --- rasa/core/run.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rasa/core/run.py b/rasa/core/run.py index 72cab14a6caf..adf9d9119067 100644 --- a/rasa/core/run.py +++ b/rasa/core/run.py @@ -72,6 +72,10 @@ def _create_single_channel(channel, credentials): def _create_app_without_api(cors: Optional[Union[Text, List[Text]]] = None): app = Sanic(__name__, configure_logging=False) add_root_route(app) + # Workaround so that socketio works with requests from other origins. + # https://github.com/miguelgrinberg/python-socketio/issues/205#issuecomment-493769183 + app.config.CORS_AUTOMATIC_OPTIONS = True + app.config.CORS_SUPPORTS_CREDENTIALS = True CORS(app, resources={r"/*": {"origins": cors or ""}}, automatic_options=True) return app