From 79b350486acc15e5ee21df347eeefb12c8c47a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Tue, 4 Apr 2023 18:57:07 +0200 Subject: [PATCH] merge fix --- server/src/uds/middleware/redirect.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/server/src/uds/middleware/redirect.py b/server/src/uds/middleware/redirect.py index 9d914f459..2435b7e98 100644 --- a/server/src/uds/middleware/redirect.py +++ b/server/src/uds/middleware/redirect.py @@ -33,7 +33,7 @@ import logging import typing from django.urls import reverse -from django.http import HttpResponseRedirect +from django.http import HttpResponsePermanentRedirect from uds.core.util.config import GlobalConfig @@ -48,13 +48,7 @@ def _check_redirectable(request: 'HttpRequest') -> typing.Optional['HttpResponse if request.is_secure(): return None - if request.method == 'POST': # No post redirects - url = reverse('page.login') - else: - url = request.build_absolute_uri(request.get_full_path()) - url = url.replace('http://', 'https://') - - return HttpResponseRedirect(url) + return HttpResponsePermanentRedirect(reverse('page.login')) # Compatibility with old middleware, so we can use it in settings.py as it was