From c391e7bc4151ae148d42acd8bbe303338cdde31c Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Mon, 7 Nov 2022 00:19:00 -0700 Subject: THE FOLLOWS, THEY WORK Well, in one direction anyway --- core/middleware.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 core/middleware.py (limited to 'core/middleware.py') diff --git a/core/middleware.py b/core/middleware.py new file mode 100644 index 0000000..8e95f06 --- /dev/null +++ b/core/middleware.py @@ -0,0 +1,13 @@ +class AlwaysSecureMiddleware: + """ + Locks the request object as always being secure, for when it's behind + a HTTPS reverse proxy. + """ + + def __init__(self, get_response): + self.get_response = get_response + + def __call__(self, request): + request.__class__.scheme = "https" + response = self.get_response(request) + return response -- cgit v1.2.3