From a3554994674a08fbc90838c4f4cd1223b2aebf67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 2 Aug 2022 14:14:34 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Support=20traefik's=20X-Forwarded-P?= =?UTF-8?q?refix=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Traefik sets `X-Forwarded-Prefix` to the prefix path if the stripPrefix middleware is used. Instead of having to define `X-Script-Name` manually in such cases, this now makes OctoPrint also check that header for prefix information. See also https://doc.traefik.io/traefik/middlewares/http/stripprefix/ --- src/octoprint/server/util/flask.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 8cc2c679f..b63d7295b 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -265,7 +265,7 @@ class ReverseProxiedEnvironment: # sensible defaults if header_prefix is None: - header_prefix = ["x-script-name"] + header_prefix = ["x-script-name", "x-forwarded-prefix"] if header_scheme is None: header_scheme = ["x-forwarded-proto", "x-scheme"] if header_host is None: