From 77b19083739bfe797e9c60e679a7f4d4040aba58 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Tue, 12 May 2020 14:27:17 -0400 Subject: [PATCH] Escapes dot characters in CORS domains --- crc/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crc/__init__.py b/crc/__init__.py index 05400ccb..2ec760b7 100644 --- a/crc/__init__.py +++ b/crc/__init__.py @@ -38,7 +38,8 @@ from crc import api connexion_app.add_api('api.yml') # Convert list of allowed origins to list of regexes -origins_re = [r"^https?:\/\/%s(.*)" % o for o in app.config['CORS_ALLOW_ORIGINS']] +origins_re = [r"^https?:\/\/%s(.*)" % o.replace('.', '\.') for o in app.config['CORS_ALLOW_ORIGINS']] +print('Allowing connections from origins matching the following regexes:', origins_re) cors = CORS(connexion_app.app, resources={r"/*": {"origins": origins_re}})