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

Commit 149c3db

Browse files
committed
Add domain specific matching for haproxy config
I ran into trouble getting federation working properly with the haproxy config specified here. After some debugging, I discovered that many federation HTTP requests, including the ones sent by the [federation tester](https://federationtester.matrix.org/), include the port number in the HTTP Host header field. For example, instead of `Host: matrix.example.com`, these federation requests look like `Host: matrix.example.com:443`. At least on haproxy 2.3, the extra port information causes the `acl matrix-host hdr(host) -i matrix.example.com` match to fail, since this is looking for an exact string match by default according to the [haproxy docs](http://cbonte.github.io/haproxy-dconv/2.3/configuration.html#7.1). This failure, in turn, causes haproxy to return error codes and causes federation to fail. Using `hdr_dom(host)`, which ignores the port information, fixes the issue in my setup. Signed-off-by: Brett Bethke <10068296+bb4242@users.noreply.github.com>
1 parent 0dd0c40 commit 149c3db

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

changelog.d/11128.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve example HAProxy config in the docs to properly handle host headers with port information. This is required for federation to work correctly.

docs/reverse_proxy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ frontend https
188188
http-request set-header X-Forwarded-For %[src]
189189
190190
# Matrix client traffic
191-
acl matrix-host hdr(host) -i matrix.example.com
191+
acl matrix-host hdr_dom(host) -i matrix.example.com
192192
acl matrix-path path_beg /_matrix
193193
acl matrix-path path_beg /_synapse/client
194194

0 commit comments

Comments
 (0)