Fediversity/matrix/nginx/workers/locations.conf

104 lines
3.6 KiB
Plaintext
Raw Normal View History

# This file describes the forwarding of (almost) every endpoint to a worker or pool of
# workers. This file should go in /etc/nginx/snippets, because we need to load it once, on
# the right place in our site-definition.
2024-12-30 14:15:39 +01:00
# Account-data
location ~ ^(/_matrix/client/(r0|v3|unstable)/.*/tags|/_matrix/client/(r0|v3|unstable)/.*/account_data) {
include snippets/proxy.conf;
proxy_pass http://account_data;
}
# Typing
location ~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing {
include snippets/proxy.conf;
proxy_pass http://typing;
}
# Receipts
location ~ ^(/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt|/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers) {
include snippets/proxy.conf;
proxy_pass http://receipts;
}
# Presence
location ~ ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ {
include snippets/proxy.conf;
proxy_pass http://presence;
}
# To device
location ~ ^/_matrix/client/(r0|v3|unstable)/sendToDevice/ {
include snippets/proxy.conf;
proxy_pass http://todevice;
}
# Push rules
location ~ ^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ {
include snippets/proxy.conf;
proxy_pass http://push_rules;
}
# Userdir
location ~ ^/_matrix/client/(r0|v3|unstable)/user_directory/search$ {
include snippets/proxy.conf;
proxy_pass http://userdir;
}
# Media, users1
location ~* ^/_matrix/((client|federation)/[^/]+/)media/ {
include snippets/proxy.conf;
proxy_pass http://media;
}
# Media, users2
location ~* ^/_matrix/media/v3/upload {
include snippets/proxy.conf;
proxy_pass http://media;
}
# Media, admin
location ~ ^/_synapse/admin/v1/(purge_)?(media(_cache)?|room|user|quarantine_media|users)/[\s\S]+|media$ {
include snippets/private.conf;
include snippets/proxy.conf;
proxy_pass http://media;
}
# Login
location ~ ^(/_matrix/client/(api/v1|r0|v3|unstable)/login|/_matrix/client/(r0|v3|unstable)/register|/_matrix/client/(r0|v3|unstable)/register/available|/_matrix/client/v1/register/m.login.registration_token/validity|/_matrix/client/(r0|v3|unstable)/password_policy)$ {
include snippets/proxy.conf;
proxy_pass http://login;
}
# Normal/initial sync
location ~ ^/_matrix/client/(r0|v3)/sync$ {
include snippets/proxy.conf;
proxy_pass http://$sync;
}
# Normal sync
location ~ ^/_matrix/client/(api/v1|r0|v3)/events$ {
include snippets/proxy.conf;
proxy_pass http://normal_sync;
}
# Initial sync
location ~ ^/_matrix/client/(api/v1|r0|v3)/initialSync$ {
include snippets/proxy.conf;
proxy_pass http://initial_sync;
}
location ~ ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$ {
include snippets/proxy.conf;
proxy_pass http://initial_sync;
}
# Federation readers
location ~ ^(/_matrix/federation/v1/event/|/_matrix/federation/v1/state/|/_matrix/federation/v1/state_ids/|/_matrix/federation/v1/backfill/|/_matrix/federation/v1/get_missing_events/|/_matrix/federation/v1/publicRooms|/_matrix/federation/v1/query/|/_matrix/federation/v1/make_join/|/_matrix/federation/v1/make_leave/|/_matrix/federation/(v1|v2)/send_join/|/_matrix/federation/(v1|v2)/send_leave/|/_matrix/federation/v1/make_knock/|/_matrix/federation/v1/send_knock/|/_matrix/federation/(v1|v2)/invite/|/_matrix/federation/v1/event_auth/|/_matrix/federation/v1/timestamp_to_event/|/_matrix/federation/v1/exchange_third_party_invite/|/_matrix/federation/v1/user/devices/|/_matrix/key/v2/query|/_matrix/federation/v1/hierarchy/|/_matrix/federation/v1/send/) {
include snippets/proxy.conf;
proxy_pass http://incoming_federation;
}
# Main thread for all the rest
location / {
include snippets/proxy.conf;
proxy_pass http://inbound_main;