From b04c4fa42deee2122acb268b39e4cb0781108d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sun, 31 Jan 2021 13:12:13 +0100 Subject: [PATCH] Force setting the SNIKKET_DOMAIN as HTTP Host when talking to prosody MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required if the portal is talking to a Prosody with multiple HTTP domains and it doesn’t have http_default_host set... In a true snikket, this doesn’t happen, but we all know... --- snikket_web/prosodyclient.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snikket_web/prosodyclient.py b/snikket_web/prosodyclient.py index 192559b..3239303 100644 --- a/snikket_web/prosodyclient.py +++ b/snikket_web/prosodyclient.py @@ -144,6 +144,7 @@ class HTTPSessionManager: async def _create(self) -> aiohttp.ClientSession: return aiohttp.ClientSession(headers={ "Accept": "application/json", + "Host": current_app.config["SNIKKET_DOMAIN"], }) async def teardown(self, exc: typing.Optional[BaseException]) -> None: @@ -204,6 +205,7 @@ class HTTPAuthSessionManager(HTTPSessionManager): headers={ "Authorization": "Bearer {}".format(token), "Accept": "application/json", + "Host": current_app.config["SNIKKET_DOMAIN"], } )