Skip to content

Commit 8a6b822

Browse files
committed
Always send /rendezvous routes to the same Synapse worker process (main) to fix QR code login
Related to matrix-org/matrix-spec-proposals#4108
1 parent 1be9944 commit 8a6b822

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

roles/custom/matrix-synapse-reverse-proxy-companion/defaults/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations: []
230230
matrix_synapse_reverse_proxy_companion_synapse_user_dir_locations: []
231231
matrix_synapse_reverse_proxy_companion_client_server_main_override_locations_regex: ^/_matrix/client/(api/v1|r0|v3|unstable)/(account/3pid/|directory/list/room/|pushrules/|rooms/[^/]+/(forget|upgrade|report)|login/sso/redirect/|register)
232232
matrix_synapse_reverse_proxy_companion_client_server_sso_override_locations_regex: ^(/_matrix/client/(api/v1|r0|v3|unstable)/login/sso/redirect|/_synapse/client/(pick_username|(new_user_consent|oidc/callback|pick_idp|sso_register)$))
233+
# Related to MSC4108 (https://github.com/matrix-org/matrix-spec-proposals/pull/4108)
234+
matrix_synapse_reverse_proxy_companion_client_server_qr_code_login_locations_regex: ^(/_matrix/client/(unstable|v1)/org.matrix.msc4108/rendezvous|/_synapse/client/rendezvous)$
235+
233236
matrix_synapse_reverse_proxy_companion_federation_override_locations_regex: ^/_matrix/federation/v1/openid/userinfo$
234237

235238
# synapse content caching

roles/custom/matrix-synapse-reverse-proxy-companion/templates/nginx/conf.d/matrix-synapse-reverse-proxy-companion.conf.j2

+17
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,23 @@ server {
125125
proxy_max_temp_file_size 0;
126126
}
127127

128+
# QR code login (`rendezvous`) locations need to go to the same Synapse process.
129+
# It doesn't necessarily need to be the main process, but it needs to be consistent.
130+
# For simplicity, we'll send them to the main process though.
131+
location ~ {{ matrix_synapse_reverse_proxy_companion_client_server_qr_code_login_locations_regex }} {
132+
{# FIXME: This block was copied from the main Synapse fallback below. It would be better to have it in one place and avoid duplication. #}
133+
{# Use the embedded DNS resolver in Docker containers to discover the service #}
134+
resolver {{ matrix_synapse_reverse_proxy_companion_http_level_resolver }} valid=5s;
135+
set $backend "{{ matrix_synapse_reverse_proxy_companion_client_api_addr }}";
136+
proxy_pass http://$backend;
137+
138+
proxy_set_header Host $host;
139+
140+
client_body_buffer_size 25M;
141+
client_max_body_size {{ matrix_synapse_reverse_proxy_companion_client_api_client_max_body_size_mb }}M;
142+
proxy_max_temp_file_size 0;
143+
}
144+
128145
{# Workers redirects BEGIN #}
129146

130147
{% if generic_workers | length > 0 %}

0 commit comments

Comments
 (0)