only apply worker redirects if workers are enabled

This commit is contained in:
Max Klenk 2020-08-27 15:25:32 +02:00
parent 567d0318b0
commit 59d1fb76b6
No known key found for this signature in database
GPG Key ID: 26EFB2972F02F380

View File

@ -101,6 +101,7 @@
} }
{% endif %} {% endif %}
{% if matrix_synapse_workers_enabled %}
{% if synchrotron_workers %} {% if synchrotron_workers %}
{# c.f. https://github.com/matrix-org/synapse/blame/master/docs/workers.md#L134 #} {# c.f. https://github.com/matrix-org/synapse/blame/master/docs/workers.md#L134 #}
location /_matrix/client/r0/sync { location /_matrix/client/r0/sync {
@ -208,6 +209,7 @@
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
} }
{% endif %} {% endif %}
{% endif %}
{% for configuration_block in matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks %} {% for configuration_block in matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks %}
{{- configuration_block }} {{- configuration_block }}
@ -282,6 +284,7 @@
} }
{% endmacro %} {% endmacro %}
{% if matrix_synapse_workers_enabled %}
{% set synchrotron_workers = matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'synchrotron')|list %} {% set synchrotron_workers = matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'synchrotron')|list %}
{% if synchrotron_workers %} {% if synchrotron_workers %}
upstream synchrotron { upstream synchrotron {
@ -294,6 +297,7 @@ upstream synchrotron {
{% endfor %} {% endfor %}
} }
{% endif %} {% endif %}
{% endif %}
server { server {
listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }}; listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
@ -376,6 +380,7 @@ server {
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
{% endif %} {% endif %}
{% if matrix_synapse_workers_enabled }
{% set federation_reader_worker = matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'federation_reader')|first %} {% set federation_reader_worker = matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'federation_reader')|first %}
{% if federation_reader_worker %} {% if federation_reader_worker %}
{# c.f. https://github.com/matrix-org/synapse/blame/master/docs/workers.md#L160 #} {# 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; proxy_set_header X-Forwarded-For $remote_addr;
} }
{% endif %} {% endif %}
{% endif %}
location / { location / {
{% if matrix_nginx_proxy_enabled %} {% if matrix_nginx_proxy_enabled %}