element-hq / element-hq/synapse

bind_addresses ipv4 not working as intended (127.0.0.1 vs 0.0.0.0)

Open
#19,505 1 comment 0 reactions 0 assignees View on GitHub
A-Docker
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

### Description

Background: On an ipv6 disabled environment, bind_addresses needs to be set in order for the container to start.

Binding to 127.0.0.1 does not work while 0.0.0.0 does. Tested on regular wsl ubuntu 24.04 and ipv6 disabled ubuntu 24.04

The documentation shows multiple examples for 127.0.0.1
[Synapse Doc: listeners](https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#listeners)

### Steps to reproduce

Taken from https://github.com/element-hq/synapse/tree/master/docker

## Generate config

```shell
docker run -it --rm \
--mount type=volume,src=synapse-data,dst=/data \
-e SYNAPSE_SERVER_NAME=my.matrix.host \
-e SYNAPSE_REPORT_STATS=yes \
matrixdotorg/synapse:latest generate
```

## Modify homeserver.yaml

modify listeners by adding bind_addresses to the default port

```yaml
listeners: # not modified
- port: 8008 # not modified
...
bind_addresses:
- 127.0.0.1 # this does NOT work
- 0.0.0.0 # this does work
...
```

## Running the container

```shell
docker run -d --name synapse \
--mount type=volume,src=synapse-data,dst=/data \
-p 8008:8008 \
matrixdotorg/synapse:latest
```

## Website

http://localhost:8008 does NOT load with 127.0.0.1 but with 0.0.0.0

### Homeserver

docker.io/matrixorg/synapse

### Synapse Version

v1.148.0 and v1.146.0

### Installation Method

Docker (matrixdotorg/synapse)

### Database

sqlite and postgres

### Workers

Single process

### Platform

Ubuntu 24.04

- tested on fresh wsl
- tested on hardened ubuntu

### Configuration

_No response_

### Relevant log output

```shell
No warnings or anything in log that is about that.
```

### Anything else that would be useful to know?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Docker setup under the repository's docker directory and the listeners section of homeserver.yaml, then reproduce the issue using the provided docker commands on an IPv6-disabled Ubuntu environment. Compare the 127.0.0.1 and 0.0.0.0 listener behavior and the linked listener documentation; done means the discrepancy is explained and the behavior or documentation is corrected and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.