element-hq / element-hq/synapse

`X-Forwarded-For` not forwarded in Apache HTTPD and Caddy reverse proxy example configuration

Open
#18,279 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

### Description

Hey.

https://element-hq.github.io/synapse/latest/reverse_proxy.html says:
> You should configure your reverse proxy to forward requests to /_matrix or /_synapse/client to Synapse, and have it set the X-Forwarded-For and X-Forwarded-Proto request headers.

But for the examples for:
- [Apache HTTPD](https://element-hq.github.io/synapse/latest/reverse_proxy.html#apache)
- [Caddy v2](https://element-hq.github.io/synapse/latest/reverse_proxy.html#caddy-v2)

don’t seem to do so.

Where they just left out by accident or are the not needed for these two (if so, that should probably be added as a hint to the documentation)?

Assuming that the field should have that remote IP address, for Apache this would probably be a line like:
```
RequestHeader set X-Forwarded-For expr=%{REMOTE_ADDR}
```
(see https://httpd.apache.org/docs/2.4/expr.html#vars)

Cheers,
Chris.

### Steps to reproduce

Was there ever any good in forcing users to fill in templates which so and so often simply don't fit the problem being described?

But here we go:
Step 1: Read the documentation.
Step 2: Use Apache HTTPD as a reverse proxy.
Step 3: Wonder why for that, the example has no `X-Forwarded-For`-header.
Step 4: Report the issue
Step 5: Waste everyone's time with filling out useless enforced fields.

### Homeserver

documentation is no homeserver

### Synapse Version

most recent documentation version on the website

### Installation Method

Other (please mention below)

### Database

I already regret taking care of reporting...

### Workers

I don't know

### Platform

Debian (well actually I'm forced to use *buntu in this case,... but I just pretend as if ^^ ...)

### Configuration

not applicable

### Relevant log output

```shell
not applicable
```

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

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.