]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Set Host header when redirecting cross-origin (#321)
authorGaurav Dhameeja <gdhameeja@gmail.com>
Fri, 6 Sep 2019 01:30:19 +0000 (07:00 +0530)
committerSeth Michael Larson <sethmichaellarson@gmail.com>
Fri, 6 Sep 2019 01:30:19 +0000 (20:30 -0500)
httpx/middleware.py

index aa994dba58e958dbc22a9c39977a2773db0f7504..dd23ac2a72d8c9608a285b1d137e239775177551 100644 (file)
@@ -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