Force setting the SNIKKET_DOMAIN as HTTP Host when talking to prosody

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...
This commit is contained in:
Jonas Schäfer
2021-01-31 13:12:13 +01:00
parent 078be4ba35
commit b04c4fa42d

View File

@@ -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"],
}
)