From 59d1fb76b65112c5e6ac8731003fe2b92642c43b Mon Sep 17 00:00:00 2001 From: Max Klenk Date: Thu, 27 Aug 2020 15:25:32 +0200 Subject: [PATCH] only apply worker redirects if workers are enabled --- .../templates/nginx/conf.d/matrix-synapse.conf.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 index 99ba7f3d..bb67ff56 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 @@ -101,6 +101,7 @@ } {% endif %} + {% if matrix_synapse_workers_enabled %} {% if synchrotron_workers %} {# c.f. https://github.com/matrix-org/synapse/blame/master/docs/workers.md#L134 #} location /_matrix/client/r0/sync { @@ -208,6 +209,7 @@ proxy_set_header X-Forwarded-For $remote_addr; } {% endif %} + {% endif %} {% for configuration_block in matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks %} {{- configuration_block }} @@ -282,6 +284,7 @@ } {% endmacro %} +{% if matrix_synapse_workers_enabled %} {% set synchrotron_workers = matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'synchrotron')|list %} {% if synchrotron_workers %} upstream synchrotron { @@ -294,6 +297,7 @@ upstream synchrotron { {% endfor %} } {% endif %} +{% endif %} server { listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }}; @@ -376,6 +380,7 @@ server { ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; {% endif %} + {% if matrix_synapse_workers_enabled } {% set federation_reader_worker = matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'federation_reader')|first %} {% if federation_reader_worker %} {# c.f. https://github.com/matrix-org/synapse/blame/master/docs/workers.md#L160 #} @@ -388,6 +393,7 @@ server { proxy_set_header X-Forwarded-For $remote_addr; } {% endif %} + {% endif %} location / { {% if matrix_nginx_proxy_enabled %}