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

Fix web_client config option #4258

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/4258.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix web_client config option
3 changes: 3 additions & 0 deletions synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def _listener_http(self, config, listener_config):
resources = {}
for res in listener_config["resources"]:
for name in res["names"]:
if not config.web_client and name == "webclient":
continue

resources.update(self._configure_named_resource(
name, res.get("compress", False),
))
Expand Down
52 changes: 4 additions & 48 deletions synapse/config/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,50 +125,6 @@ def read_config(self, config):

self.gc_thresholds = read_gc_thresholds(config.get("gc_thresholds", None))

bind_port = config.get("bind_port")
if bind_port:
self.listeners = []
bind_host = config.get("bind_host", "")
gzip_responses = config.get("gzip_responses", True)

names = ["client", "webclient"] if self.web_client else ["client"]

self.listeners.append({
"port": bind_port,
"bind_addresses": [bind_host],
"tls": True,
"type": "http",
"resources": [
{
"names": names,
"compress": gzip_responses,
},
{
"names": ["federation"],
"compress": False,
}
]
})

unsecure_port = config.get("unsecure_port", bind_port - 400)
if unsecure_port:
self.listeners.append({
"port": unsecure_port,
"bind_addresses": [bind_host],
"tls": False,
"type": "http",
"resources": [
{
"names": names,
"compress": gzip_responses,
},
{
"names": ["federation"],
"compress": False,
}
]
})

manhole = config.get("manhole")
if manhole:
self.listeners.append({
Expand Down Expand Up @@ -201,10 +157,10 @@ def read_config(self, config):
def default_config(self, server_name, **kwargs):
_, bind_port = parse_and_validate_server_name(server_name)
if bind_port is not None:
unsecure_port = bind_port - 400
insecure_port = bind_port - 400
else:
bind_port = 8448
unsecure_port = 8008
insecure_port = 8008

pid_file = self.abspath("homeserver.pid")
return """\
Expand Down Expand Up @@ -333,9 +289,9 @@ def default_config(self, server_name, **kwargs):
# module: my_module.CustomRequestHandler
# config: {}

# Unsecure HTTP listener,
# Insecure HTTP listener,
# For when matrix traffic passes through loadbalancer that unwraps TLS.
- port: %(unsecure_port)s
- port: %(insecure_port)s
tls: false
bind_addresses: ['::', '0.0.0.0']
type: http
Expand Down