From 3f99f7edffa57d7219a052fae039b70c56358e76 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 23 Apr 2022 20:16:28 +0700 Subject: [PATCH] add localhost to allowed origin, optional cors disable --- tubearchivist/config/settings.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tubearchivist/config/settings.py b/tubearchivist/config/settings.py index 8e8bf5a..d24e718 100644 --- a/tubearchivist/config/settings.py +++ b/tubearchivist/config/settings.py @@ -146,7 +146,16 @@ LOGOUT_REDIRECT_URL = "/login/" # Cors needed for browser extension # background.js makes the request so HTTP_ORIGIN will be from extension -CORS_ALLOWED_ORIGIN_REGEXES = [r"moz-extension://*", r"chrome-extension://*"] +if environ.get("DISABLE_CORS"): + # disable cors + CORS_ORIGIN_ALLOW_ALL = True +else: + CORS_ALLOWED_ORIGIN_REGEXES = [ + r"moz-extension://*", + r"chrome-extension://*", + ] + CORS_ALLOWED_ORIGINS = ["http://localhost:8080"] + CORS_ALLOW_HEADERS = list(default_headers) + [ "mode",