Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix redirecting to the webclient for non-HTTP(S) web_client_location. (
Browse files Browse the repository at this point in the history
…#11783)

To not change the behaviour during the deprecation period.

Follow-up to #11774.
  • Loading branch information
clokep authored Jan 20, 2022
1 parent 121b9e2 commit d090996
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/11783.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate support for `webclient` listeners and non-HTTP(S) `web_client_location` configuration.
9 changes: 8 additions & 1 deletion synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,18 @@ def _listener_http(
resources.update(self._module_web_resources)
self._module_web_resources_consumed = True

# try to find something useful to redirect '/' to
# Try to find something useful to serve at '/':
#
# 1. Redirect to the web client if it is an HTTP(S) URL.
# 2. Redirect to the web client served via Synapse.
# 3. Redirect to the static "Synapse is running" page.
# 4. Do not redirect and use a blank resource.
if self.config.server.web_client_location_is_redirect:
root_resource: Resource = RootOptionsRedirectResource(
self.config.server.web_client_location
)
elif WEB_CLIENT_PREFIX in resources:
root_resource = RootOptionsRedirectResource(WEB_CLIENT_PREFIX)
elif STATIC_PREFIX in resources:
root_resource = RootOptionsRedirectResource(STATIC_PREFIX)
else:
Expand Down

0 comments on commit d090996

Please sign in to comment.