Skip to content

Commit 2fb3a42

Browse files
authored
Check HTTP_X_FORWARDED_PROTO as alternsative to DESTINATION header (#187)
Update #183
1 parent 1a5d7f7 commit 2fb3a42

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

wsgidav/request_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,10 @@ def _debug_exception(e):
941941
if src_res.is_collection:
942942
dest_path = dest_path.rstrip("/") + "/"
943943

944-
if dest_scheme and dest_scheme.lower() != environ["wsgi.url_scheme"].lower():
944+
dest_scheme = dest_scheme.lower() if dest_scheme else ""
945+
url_scheme = environ["wsgi.url_scheme"].lower()
946+
fwd_scheme = environ.get("HTTP_X_FORWARDED_PROTO", "").lower()
947+
if dest_scheme and dest_scheme not in (url_scheme, fwd_scheme):
945948
self._fail(
946949
HTTP_BAD_GATEWAY,
947950
"Source and destination must have the same scheme.\n"

0 commit comments

Comments
 (0)