From 7e6ce22d64e845cacaf27f76d91b56ef6d91effa Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 19:17:30 +0530 Subject: [PATCH] perf: optimise set_cors_headers (bp #12460) (#12462) (cherry picked from commit 68c6fc4a4417c6c36132ef25ec96af522d351dd6) Co-authored-by: Sagar Vora --- frappe/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/app.py b/frappe/app.py index adf2bfa8c9..7ec88b06cf 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -152,10 +152,10 @@ def process_response(response): def set_cors_headers(response): origin = frappe.request.headers.get('Origin') - if not origin: + allow_cors = frappe.conf.allow_cors + if not (origin and allow_cors): return - allow_cors = frappe.conf.allow_cors if allow_cors != "*": if not isinstance(allow_cors, list): allow_cors = [allow_cors]