Skip to content

Commit

Permalink
add cors config to app without api
Browse files Browse the repository at this point in the history
  • Loading branch information
erohmensing committed Sep 25, 2019
1 parent 7456dc3 commit 7decd47
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rasa/core/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7decd47

Please sign in to comment.