Skip to content

Commit

Permalink
Added HAProxy example
Browse files Browse the repository at this point in the history
Proposal of an example with HAProxy. Asked by matrix-org#4541.

Signed-off-by: Benoît S. (“Benpro”) <[email protected]>
  • Loading branch information
Benoît S authored and Benoît S. (“Benpro”) committed Feb 17, 2019
1 parent f830a3b commit a826f66
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/4541.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added an HAProxy example in the reverse proxy documentation. Contributed by Benoît S. (“Benpro”).
22 changes: 22 additions & 0 deletions docs/reverse_proxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ Let's assume that we expect clients to connect to our server at
</Location>
</VirtualHost>

* HAProxy::

frontend https
bind 0.0.0.0:443 v4v6 ssl crt /etc/ssl/haproxy/ strict-sni alpn h2,http/1.1
bind :::443 ssl crt /etc/ssl/haproxy/ strict-sni alpn h2,http/1.1
# A standard website
acl www hdr(host) -i www.example.com
use_backend www if www
# Matrix-Synapse
acl matrix hdr(host) -i matrix.example.com
use_backend matrix if matrix
frontend matrix-synapse
bind 0.0.0.0:8448 v4v6 ssl crt /etc/ssl/haproxy/synapse.pem alpn h2,http/1.1
bind :::8448 ssl crt /etc/ssl/haproxy/synapse.pem alpn h2,http/1.1
default_backend matrix
backend matrix
server matrix 127.0.0.1:8008

You will also want to set ``bind_addresses: ['127.0.0.1']`` and ``x_forwarded: true``
for port 8008 in ``homeserver.yaml`` to ensure that client IP addresses are
recorded correctly.
Expand Down

0 comments on commit a826f66

Please sign in to comment.