From a185baccdd572d8e90e92644c4b0ab47b29c8e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Wed, 25 Oct 2017 13:45:22 +0200 Subject: [PATCH] fixed so /rest is allowed --- server/src/uds/core/util/middleware/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/uds/core/util/middleware/__init__.py b/server/src/uds/core/util/middleware/__init__.py index c069bd8f0..32925ad34 100644 --- a/server/src/uds/core/util/middleware/__init__.py +++ b/server/src/uds/core/util/middleware/__init__.py @@ -47,11 +47,12 @@ class XUACompatibleMiddleware(object): class RedirectMiddleware(object): def process_request(self, request): - if GlobalConfig.REDIRECT_TO_HTTPS.getBool() and request.is_secure() is False: + full_path = request.get_full_path() + if GlobalConfig.REDIRECT_TO_HTTPS.getBool() and request.is_secure() is False and full_path[:6] != '/rest/': if request.method == 'POST': url = request.build_absolute_uri(GlobalConfig.LOGIN_URL.get()) else: - url = request.build_absolute_uri(request.get_full_path()) + url = request.build_absolute_uri(full_path) url = url.replace('http://', 'https://') return HttpResponseRedirect(url)