From efb49d009915ed31b64468ca4f9433fd363daa2a Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Tue, 15 Oct 2024 14:14:26 +0500 Subject: [PATCH] Simplify haproxy config --- roles/haproxy/files/haproxy.cfg | 43 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/roles/haproxy/files/haproxy.cfg b/roles/haproxy/files/haproxy.cfg index ddbeb01..b546797 100644 --- a/roles/haproxy/files/haproxy.cfg +++ b/roles/haproxy/files/haproxy.cfg @@ -32,30 +32,35 @@ frontend www acl host_mastodon_tor hdr(host) -i mcomfyzeyibt2unmkttoxa2li2dzpsljcp3sasrioqsks4ayrl5kk2ad.onion - http-request redirect scheme https if !{ ssl_fc } !host_mastodon_tor + http-request redirect scheme https unless { ssl_fc } || host_mastodon_tor http-request set-header X-Forwarded-Proto https if { ssl_fc } http-request set-header X-Forwarded-Proto http if !{ ssl_fc } acl host_mastodon hdr(host) -i m.comfycamp.space - acl acl_s3 hdr(host) -i s3.comfycamp.space - acl acl_comfycamp hdr(host) -i comfycamp.space - acl acl_vaultwarden hdr(host) -i vault.comfycamp.space - acl acl_minio hdr(host) -i minio.comfycamp.space - acl acl_git hdr(host) -i git.comfycamp.space - - acl matrix-host hdr(host) -i matrix.comfycamp.space matrix.comfycamp.space:443 - acl matrix-path path_beg /_matrix - acl matrix-path path_beg /_synapse/client - - use_backend mastodon_streaming if host_mastodon { path_beg /api/v1/streaming } - use_backend mastodon_streaming if host_mastodon_tor { path_beg /api/v1/streaming } + acl path_streaming_api path_beg /api/v1/streaming + use_backend mastodon_streaming if host_mastodon path_streaming_api + use_backend mastodon_streaming if host_mastodon_tor path_streaming_api use_backend mastodon if host_mastodon || host_mastodon_tor - use_backend minio if acl_s3 - use_backend matrix if matrix-host matrix-path - use_backend minio_console if acl_minio - use_backend vaultwarden if acl_vaultwarden - use_backend comfycamp if acl_comfycamp - use_backend forgejo if acl_git + + acl host_matrix hdr(host) -i matrix.comfycamp.space matrix.comfycamp.space:443 + acl path_matrix path_beg /_matrix + acl path_matrix path_beg /_synapse/client + use_backend matrix if host_matrix path_matrix + + acl host_s3 hdr(host) -i s3.comfycamp.space + use_backend minio if host_s3 + + acl host_comfycamp hdr(host) -i comfycamp.space + use_backend comfycamp if host_comfycamp + + acl host_vaultwarden hdr(host) -i vault.comfycamp.space + use_backend vaultwarden if host_vaultwarden + + acl host_minio hdr(host) -i minio.comfycamp.space + use_backend minio_console if host_minio + + acl host_git hdr(host) -i git.comfycamp.space + use_backend forgejo if host_git frontend matrix-federation bind *:8448 ssl crt /usr/local/etc/haproxy/certs