From: Gaurav Dhameeja Date: Fri, 6 Sep 2019 01:30:19 +0000 (+0530) Subject: Set Host header when redirecting cross-origin (#321) X-Git-Tag: 0.7.3~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3065dd6b6ca347f182cfe1fb26195f6c90c631ca;p=thirdparty%2Fhttpx.git Set Host header when redirecting cross-origin (#321) --- diff --git a/httpx/middleware.py b/httpx/middleware.py index aa994dba..dd23ac2a 100644 --- a/httpx/middleware.py +++ b/httpx/middleware.py @@ -148,7 +148,7 @@ class RedirectMiddleware(BaseMiddleware): # Strip Authorization headers when responses are redirected away from # the origin. del headers["Authorization"] - del headers["Host"] + headers["Host"] = url.authority if method != request.method and method == "GET": # If we've switch to a 'GET' request, then strip any headers which