diff --git a/changelog.d/4258.bugfix b/changelog.d/4258.bugfix new file mode 100644 index 000000000000..42ca9d933479 --- /dev/null +++ b/changelog.d/4258.bugfix @@ -0,0 +1 @@ +Fix web_client config option diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 3e4dea2f196a..3bf5e9a1c016 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -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), )) diff --git a/synapse/config/server.py b/synapse/config/server.py index 5ff9ac288daa..6a067688f692 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -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({ @@ -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 """\ @@ -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