diff --git a/synapse/config/server.py b/synapse/config/server.py
index 634d8e6fe5..1f9999d57a 100644
--- a/synapse/config/server.py
+++ b/synapse/config/server.py
@@ -42,6 +42,15 @@ class ServerConfig(Config):
self.listeners = config.get("listeners", [])
+ for listener in self.listeners:
+ bind_address = listener.pop("bind_address", None)
+ bind_addresses = listener.setdefault("bind_addresses", [])
+
+ if bind_address:
+ bind_addresses.append(bind_address)
+ elif not bind_addresses:
+ bind_addresses.append('')
+
self.gc_thresholds = read_gc_thresholds(config.get("gc_thresholds", None))
bind_port = config.get("bind_port")
@@ -54,7 +63,7 @@ class ServerConfig(Config):
self.listeners.append({
"port": bind_port,
- "bind_address": bind_host,
+ "bind_addresses": [bind_host],
"tls": True,
"type": "http",
"resources": [
@@ -73,7 +82,7 @@ class ServerConfig(Config):
if unsecure_port:
self.listeners.append({
"port": unsecure_port,
- "bind_address": bind_host,
+ "bind_addresses": [bind_host],
"tls": False,
"type": "http",
"resources": [
@@ -92,7 +101,7 @@ class ServerConfig(Config):
if manhole:
self.listeners.append({
"port": manhole,
- "bind_address": "127.0.0.1",
+ "bind_addresses": ["127.0.0.1"],
"type": "manhole",
})
@@ -100,7 +109,7 @@ class ServerConfig(Config):
if metrics_port:
self.listeners.append({
"port": metrics_port,
- "bind_address": config.get("metrics_bind_host", "127.0.0.1"),
+ "bind_addresses": [config.get("metrics_bind_host", "127.0.0.1")],
"tls": False,
"type": "http",
"resources": [
@@ -155,9 +164,14 @@ class ServerConfig(Config):
# The port to listen for HTTPS requests on.
port: %(bind_port)s
- # Local interface to listen on.
- # The empty string will cause synapse to listen on all interfaces.
- bind_address: ''
+ # Local addresses to listen on.
+ # This will listen on all IPv4 addresses by default.
+ bind_addresses:
+ - '0.0.0.0'
+ # Uncomment to listen on all IPv6 interfaces
+ # N.B: On at least Linux this will also listen on all IPv4
+ # addresses, so you will need to comment out the line above.
+ # - '::'
# This is a 'http' listener, allows us to specify 'resources'.
type: http
@@ -188,7 +202,7 @@ class ServerConfig(Config):
# For when matrix traffic passes through loadbalancer that unwraps TLS.
- port: %(unsecure_port)s
tls: false
- bind_address: ''
+ bind_addresses: ['0.0.0.0']
type: http
x_forwarded: false
|