Skip to content

Commit

Permalink
Put proxy_set_header Host $host; at the server level for `matrix-…
Browse files Browse the repository at this point in the history
…synapse-reverse-proxy-companion`

Continuation of the refactoring done in 10fabc3
  • Loading branch information
spantaleev committed Feb 27, 2025
1 parent 10fabc3 commit 37f8417
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
{% for location in locations %}
location ~ {{ location }} {
proxy_pass http://{{ upstream_name }}$request_uri;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
Expand Down Expand Up @@ -96,6 +95,7 @@ server {

proxy_buffering on;
proxy_max_temp_file_size 0;
proxy_set_header Host $host;

{% if matrix_synapse_reverse_proxy_companion_synapse_workers_enabled %}
# Client-server overrides — These locations must go to the main Synapse process
Expand All @@ -105,8 +105,6 @@ server {
resolver {{ matrix_synapse_reverse_proxy_companion_http_level_resolver }} valid=5s;
set $backend "{{ matrix_synapse_reverse_proxy_companion_client_api_addr }}";
proxy_pass http://$backend;

proxy_set_header Host $host;
}

# Client-server SSO overrides — These locations must go to the main Synapse process
Expand All @@ -116,8 +114,6 @@ server {
resolver {{ matrix_synapse_reverse_proxy_companion_http_level_resolver }} valid=5s;
set $backend "{{ matrix_synapse_reverse_proxy_companion_client_api_addr }}";
proxy_pass http://$backend;

proxy_set_header Host $host;
}

# QR code login (`rendezvous`) locations need to go to the same Synapse process.
Expand All @@ -129,8 +125,6 @@ server {
resolver {{ matrix_synapse_reverse_proxy_companion_http_level_resolver }} valid=5s;
set $backend "{{ matrix_synapse_reverse_proxy_companion_client_api_addr }}";
proxy_pass http://$backend;

proxy_set_header Host $host;
}

{# Workers redirects BEGIN #}
Expand Down Expand Up @@ -191,7 +185,6 @@ server {
{% for location in matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations %}
location ~ {{ location }} {
proxy_pass http://media_repository_workers_upstream$request_uri;
proxy_set_header Host $host;

{% if matrix_synapse_reverse_proxy_companion_synapse_cache_enabled %}
proxy_cache {{ matrix_synapse_reverse_proxy_companion_synapse_cache_keys_zone_name }};
Expand Down Expand Up @@ -220,8 +213,6 @@ server {
resolver {{ matrix_synapse_reverse_proxy_companion_http_level_resolver }} valid=5s;
set $backend "{{ matrix_synapse_reverse_proxy_companion_client_api_addr }}";
proxy_pass http://$backend;

proxy_set_header Host $host;
}
}

Expand All @@ -238,6 +229,7 @@ server {

proxy_buffering on;
proxy_max_temp_file_size 0;
proxy_set_header Host $host;

{% if matrix_synapse_reverse_proxy_companion_synapse_workers_enabled %}
# Federation overrides — These locations must go to the main Synapse process
Expand All @@ -247,8 +239,6 @@ server {
resolver {{ matrix_synapse_reverse_proxy_companion_http_level_resolver }} valid=5s;
set $backend "{{ matrix_synapse_reverse_proxy_companion_federation_api_addr }}";
proxy_pass http://$backend;

proxy_set_header Host $host;
}

{% if room_workers | length > 0 %}
Expand All @@ -266,7 +256,6 @@ server {
{% for location in matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations %}
location ~ {{ location }} {
proxy_pass http://media_repository_workers_upstream$request_uri;
proxy_set_header Host $host;

{% if matrix_synapse_reverse_proxy_companion_synapse_cache_enabled %}
proxy_buffering on;
Expand Down Expand Up @@ -303,8 +292,6 @@ server {
resolver {{ matrix_synapse_reverse_proxy_companion_http_level_resolver }} valid=5s;
set $backend "{{ matrix_synapse_reverse_proxy_companion_federation_api_addr }}";
proxy_pass http://$backend;

proxy_set_header Host $host;
}
}
{% endif %}

0 comments on commit 37f8417

Please sign in to comment.