# Choose sync worker based on the existence of "since" query parameter map $arg_since $sync { default sync_worker; '' sync_init; } # Sync initial/normal location ~ ^/_matrix/client/(r0|v3)/sync$ { include snippets/matrix-proxy-headers.conf; proxy_pass http://$sync; proxy_read_timeout 1h; } # Normal sync location ~ ^/_matrix/client/(api/v1|r0|v3)/events$ { include snippets/matrix-proxy-headers.conf; proxy_pass http://sync_worker; } # Initial_sync location ~ ^/_matrix/client/(api/v1|r0|v3)/initialSync$ { include snippets/matrix-proxy-headers.conf; proxy_pass http://sync_init; proxy_read_timeout 1h; } location ~ ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$ { include snippets/matrix-proxy-headers.conf; proxy_pass http://sync_init; proxy_read_timeout 1h; }