@@ -368,143 +368,76 @@ ingress:
368368 ingressClassName : nginx
369369 # client-server overides should go first and always to main/master process
370370 masterOverridesRoutes :
371- # client-server overrides to the main/master process process
372- - " /_matrix/client/(api/v1|r0|v3|unstable)/(account/3pid/|directory/list/room/|rooms/[^/]+/(forget|upgrade|report)|register)"
373- # qr code rendezvous loginto main process
374- # related to MSC4108 https://github.com/matrix-org/matrix-spec-proposals/pull/4108
375- # - "(/_matrix/client/(unstable|v1)/org.matrix.msc4108/rendezvous|/_synapse/client/rendezvous)$"
376- # this should fix spec.rules[0].http.paths[2].path: must be an absolute path
371+ - " /_matrix/client/(api/v1|r0|v3|unstable)/(account/3pid/|directory/list/room/|rooms/[^/]+/(forget|upgrade|report)|register).*"
377372 - " /_matrix/client/(unstable|v1)/org.matrix.msc4108/rendezvous$"
378373 - " /_synapse/client/rendezvous$"
379- # federation overrides to main/master process
380- # - "/_matrix/federation/v1/openid/userinfo$" # should go to federation reader
381- # send all other traffic to the main/master process, should go last in lb config
374+
382375 masterRoutes :
383- - " /_matrix/"
384- - " /_synapse/"
385- # https://matrix-org.github.io/synapse/latest/workers.html#the-typing-stream
386- # routes to typing stream writer singleton worker
387- # source: room.py:1472 client_patterns("/rooms/.*/typing/...", v1=True) -> (api/v1|r0|v3|unstable)
376+ - " /_matrix/.*"
377+ - " /_synapse/.*"
378+
388379 typing :
389- # - "/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing"
390- - " /_matrix/client/(api/v1|r0|v3|unstable)/rooms/[^/]+/typing"
391- # this is hack to make this regexp longer, because ImplementationSpecific chose longest if both match
392- # - "/_matrix/client/(api/v1|r0|v3|unstable)/rooms/(?:%21|!)[A-Za-z0-9._=\\-]+(?::|%3[Aa])[A-Za-z0-9.\\-]+/typing"
393- # https://matrix-org.github.io/synapse/latest/workers.html#the-to_device-stream
394- # routes to to_device stream writer singleton worker
395- # source: sendtodevice.py:42 client_patterns("/sendToDevice/...") -> (r0|v3|unstable)
380+ - " /_matrix/client/(api/v1|r0|v3|unstable)/rooms/[^/]+/typing.*"
381+
396382 toDevice :
397- - " /_matrix/client/(r0|v3|unstable)/sendToDevice/"
398- # https://matrix-org.github.io/synapse/latest/workers.html#the-account_data-stream
399- # routes to account_data stream writer singleton worker
400- # source: account_data.py, tags.py - all client_patterns() without v1 -> (r0|v3|unstable)
383+ - " /_matrix/client/(r0|v3|unstable)/sendToDevice/.*"
384+
401385 accountData :
402- # original
403- - " /_matrix/client/(r0|v3|unstable)/.*/tags"
404- - " /_matrix/client/(r0|v3|unstable)/.*/account_data"
405- # fix priority
406- # - '/_matrix/client/(r0|v3|unstable)/user/[^/]+/rooms/(?:%21|!)[A-Za-z0-9._=\-]+(?::|%3[Aa])[A-Za-z0-9.\-]+/account_data'
407- # - '/_matrix/client/(r0|v3|unstable)/user/[^/]+/rooms/(?:%21|!)[A-Za-z0-9._=\-]+(?::|%3[Aa])[A-Za-z0-9.\-]+/tags'
408- # https://matrix-org.github.io/synapse/latest/workers.html#the-receipts-stream
409- # routes to receipts stream writer multiple workers
410- # source: receipts.py:41, read_marker.py:40 - client_patterns() -> (r0|v3|unstable)
411- # Caution(!): patterns must be longer than roomRoutes (73 chars) because of ImplementationSpecific
412- # Both receipt URLs contain a room ID and would otherwise match roomRoutes first (longest wins),
413- # routing to room workers which are NOT receipts stream writers -> assert _can_write_to_receipts -> 500
386+ - " /_matrix/client/(r0|v3|unstable)/.*/tags.*"
387+ - " /_matrix/client/(r0|v3|unstable)/.*/account_data.*"
388+
414389 receipts :
415- # original
416- # - "/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt"
417- # - "/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers"
418- - ' /_matrix/client/(r0|v3|unstable)/rooms/[^/]+/receipt'
419- - ' /_matrix/client/(r0|v3|unstable)/rooms/[^/]+/read_markers'
420- # - "/_matrix/client/(r0|v3|unstable)/rooms/(?:%21|!)[A-Za-z0-9._=\\-]+(?::|%3[Aa])[A-Za-z0-9.\\-]+/receipt"
421- # - "/_matrix/client/(r0|v3|unstable)/rooms/(?:%21|!)[A-Za-z0-9._=\\-]+(?::|%3[Aa])[A-Za-z0-9.\\-]+/read_markers"
422- # https://matrix-org.github.io/synapse/latest/workers.html#the-presence-stream
423- # routes to presence stream writer singleton worker
424- # source: presence.py:43 client_patterns("/presence/.../status", v1=True) -> (api/v1|r0|v3|unstable)
390+ - ' /_matrix/client/(r0|v3|unstable)/rooms/[^/]+/receipt.*'
391+ - ' /_matrix/client/(r0|v3|unstable)/rooms/[^/]+/read_markers$'
392+
425393 presence :
426- - " /_matrix/client/(api/v1|r0|v3|unstable)/presence/"
427- # https://element-hq.github.io/synapse/latest/workers.html#the-push_rules-stream
428- # routes to push_rules stream writer singleton worker
429- # source: push_rule.py:51 client_patterns("/pushrules/...", v1=True) -> (api/v1|r0|v3|unstable)
394+ - " /_matrix/client/(api/v1|r0|v3|unstable)/presence/.*"
395+
430396 pushRulesRoutes :
431- # short version
432- - " /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/"
433- # long version because of ingress
434- # - "/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/(global|device)/(override|underride|sender|room|content|default)/"
435- # https://element-hq.github.io/synapse/latest/workers.html#the-device_lists-stream
436- # routes to device_lists stream writer multiple workers
437- # source: devices.py:79 client_patterns("/delete_devices") -> (r0|v3|unstable)
438- # workers.md documents only (r0|v3); unstable form falls to main - acceptable per docs
439- # source: keys.py:507 client_patterns("/keys/device_signing/upload$", releases=("v3",)) -> (v3|unstable)
440- # (api/v1|r0|v3|unstable) is over-permissive vs source but harmless
397+ - " /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/.*"
398+
441399 deviceListsRoutes :
442400 - " /_matrix/client/(r0|v3|unstable)/keys/query$"
443401 - " /_matrix/client/(r0|v3|unstable)/keys/changes$"
444402 - " /_matrix/client/(r0|v3|unstable)/keys/claim$"
445- # - "/_matrix/client/(r0|v3|unstable)/room_keys/"
446- - " /_matrix/client/(r0|v3|unstable)/keys/upload/"
403+ - " /_matrix/client/(r0|v3|unstable)/keys/upload/.*"
447404 - " /_matrix/client/(r0|v3|unstable)/delete_devices$"
448- - " /_matrix/client/(api/v1|r0|v3|unstable)/devices(/|$)"
449- - " /_matrix/client/(r0|v3|unstable)/keys/upload(/|$)"
450- # keys.py:507 unexistent prefixes api/v1 and r0 device_lists
405+ - " /_matrix/client/(api/v1|r0|v3|unstable)/devices(/.*)?$"
406+ - " /_matrix/client/(r0|v3|unstable)/keys/upload(/.*)?$"
451407 - " /_matrix/client/(api/v1|r0|v3|unstable)/keys/device_signing/upload$"
452408 - " /_matrix/client/(api/v1|r0|v3|unstable)/keys/signatures/upload$"
453- # hack:
454- # - '/_matrix/client/(r0|v3|unstable)/room_keys/keys/(?:%21|!)[A-Za-z0-9._=\-/]+(?::|%3[Aa])[A-Za-z0-9.\-]+'
455- # https://github.com/element-hq/synapse/blob/b99a58719b274fcbb327fd8d7649185792bfd12c/synapse/rest/client/thread_subscriptions.py#L38-L247
456- # stream writer multiple worker
409+
457410 threadSubscriptionsRoutes :
458411 - " /_matrix/client/unstable/io.element.msc4306/rooms/.*/thread/.*/subscription$"
459412 - " /_matrix/client/unstable/io.element.msc4308/thread_subscriptions$"
460- # TODO: implement this for 1.152, should be stream writer multiple worker
461- # https://element-hq.github.io/synapse/latest/workers.html#the-quarantined_media_changes-stream
462- # quarantinedMediaRoutes:
463- # - "/_synapse/admin/v1/quarantine_media/.*$" # move here from mediaRepository in 1.152
464- # room worker, consistent hash by room_id, unlimited scale
465- # client-server: any request with room id in url
413+
466414 roomRoutes :
467415 - ' /_matrix/client/.*(?:%21|!)[A-Za-z0-9._=/-]+(?::|%3[Aa])[A-Za-z0-9.-]+.*$'
468- # - '/_matrix/client/.*?!(?<room>[A-Za-z0-9._=\-\/]+):[A-Za-z0-9.\-]+'
469- # - '/_matrix/client/.*?(?:%21|!)(?<room>[A-Za-z0-9._=\-\/]+)(?::|%3A)[A-Za-z0-9.\-]+'
470- # room (!sic) worker, consistent hash by room_id, unlimited scale
471- # federation specific, must be AFTER masterOverridesRoutes
472- # workers.md: state_ids and get_missing_events are v1 only; v[12] is over-permissive but harmless
473- # roomFederationRoutes:
474- # - '/_matrix/federation/v[12]/(?:state_ids|get_missing_events)/(?:%21|!)(?<room>[A-Za-z0-9._=\-\/]+)(:|%3A)[A-Za-z0-9.\-]+'
475- # https://matrix-org.github.io/synapse/latest/workers.html#synapseappmedia_repository
416+
476417 mediaRepository :
477- - " /_matrix/media/"
478- - " /_matrix/client/v1/media/"
479- - " /_matrix/federation/v1/media/"
418+ - " /_matrix/media/.* "
419+ - " /_matrix/client/v1/media/.* "
420+ - " /_matrix/federation/v1/media/.* "
480421 - " /_synapse/admin/v1/purge_media_cache$"
481422 - " /_synapse/admin/v1/room/.*/media.*$"
482423 - " /_synapse/admin/v1/user/.*/media.*$"
483424 - " /_synapse/admin/v1/media/.*$"
484- - " /_synapse/admin/v1/quarantine_media/.*$" # remove in 1.152 (move to quarantinedMediaRoutes)
425+ - " /_synapse/admin/v1/quarantine_media/.*$"
485426 - " /_synapse/admin/v1/users/.*/media$"
486- # sync workers, unlimited scale, sticky per user (whoami-based consistent hash)
487- # source: sync.py:109 client_patterns("/sync$") -> (r0|v3|unstable); api/v1 here is over-permissive but harmless
488- # source: events.py:43 client_patterns("/events$", v1=True) -> (api/v1|r0|v3|unstable) ✓
427+
489428 syncRoutes :
490- # - "/_matrix/client/(r0|v3)/sync$"
491429 - " /_matrix/client/(r0|v3|unstable)/sync$"
492430 - " /_matrix/client/(api/v1|r0|v3)/events$"
493431 - " /_matrix/client/(api/v1|r0|v3)/initialSync$"
494432 - " /_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$"
495- - ' /_matrix/client/(r0|v3|unstable)/room_keys'
496- # Native Sliding Sync MSC3575
497- # source: sync.py:785 client_patterns("/org.matrix.simplified_msc3575/sync$", releases=[], unstable=True)
433+ - ' /_matrix/client/(r0|v3|unstable)/room_keys.*'
498434 - " /_matrix/client/unstable/org.matrix.simplified_msc3575/sync$"
499- # `update_user_directory_from_worker: worker-name`
435+
500436 userDirectoryRoutes :
501437 - " /_matrix/client/(r0|v3|unstable)/user_directory/search$"
502- # https://matrix-org.github.io/synapse/latest/workers.html#synapseappgeneric_worker
503- # scalable unlimited by least_conn lb algo
438+
504439 clientReaderRoutes :
505440 - ' /_matrix/client/versions$'
506- # - '/_matrix/client/(r0|v3|unstable)/room_keys/'
507- # - '/_matrix/client/(r0|v3|unstable)/room_keys/version'
508441 - ' /_matrix/client/(r0|v3|unstable)/notifications$'
509442 - ' /_matrix/client/(api/v1|r0|v3|unstable)/room_keys/.*$'
510443 - ' /_matrix/client/(api/v1|r0|v3|unstable)/keys/(query|changes|claim|room_keys/).*$'
@@ -527,54 +460,22 @@ ingress:
527460 - ' /_matrix/client/(api/v1|r0|v3|unstable)/directory/room/.*$'
528461 - ' /_matrix/client/(api/v1|r0|v3|unstable)/user/.*/filter(/|$).*$'
529462 - ' /_matrix/client/unstable/org\.matrix\.msc4143/rtc/transports(?:\?.*)?$'
530- # disabled if MAS is enabled
531- # NOTE: /register* entries here are shadowed by masterOverridesRoutes `register` (no $ anchor).
532- # Only login$ and password_policy$ can actually reach client_reader.
463+
533464 clientReaderRegister :
534- # source: login.py:76 client_patterns("/login$", v1=True) -> (api/v1|r0|v3|unstable)
535465 - " /_matrix/client/(api/v1|r0|v3|unstable)/login$"
536- # source: register.py:434 client_patterns("/register$") -> (r0|v3|unstable)
537466 - " /_matrix/client/(r0|v3|unstable)/register$"
538- # source: register.py:341 client_patterns("/register/available") -> (r0|v3|unstable)
539467 - " /_matrix/client/(r0|v3|unstable)/register/available$"
540- # source: register.py:403 client_patterns("/register/m.login.registration_token/validity", releases=("v1",)) -> (v1|unstable)
541468 - " /_matrix/client/v1/register/m.login.registration_token/validity$"
542- # source: no specific password_policy file found; workers.md:276 documents (r0|v3|unstable)
543469 - " /_matrix/client/(r0|v3|unstable)/password_policy$"
470+
544471 federationReaderRoutes :
545- # original:
546- - " /_matrix/(federation/(v1|v2)|key/v2)/"
547- # NGINX ingress sorts ImplementationSpecific regex paths by string length (longer = higher priority).
548- # This pattern (56 chars) is tried before shorter routes, so negative lookaheads are required to
549- # prevent shadowing:
550- # - (?!/(media|openid)) excludes:
551- # /_matrix/federation/v1/media/ (29 chars) -> must go to synapse-media-repository
552- # /_matrix/federation/v1/openid/ (37 chars) -> must go to synapse-master (masterOverridesRoutes)
553- # - "/_matrix/(federation/(v1|v2)(?!/(media|openid))|key/v2)/"
554- # enabled if MAS is enabled, mutually exclusive with clientReaderRegister
555- # source: login.py:76,588 logout.py:38,65
556- # Fixed: explicit version prefixes instead of greedy (.*) to avoid matching subpaths unexpectedly
557- # logout has v1=True -> (api/v1|r0|v3|unstable); refresh has no v1 -> (r0|v3|unstable)
472+ - " /_matrix/(federation/(v1|v2)|key/v2)/.*"
473+
558474 matrixAuthentication :
559- - " /_matrix/client/(api/v1|r0|v3|unstable)/login/sso/redirect(/|$) "
475+ - " /_matrix/client/(api/v1|r0|v3|unstable)/login/sso/redirect(/.*)?$ "
560476 - " /_matrix/client/(api/v1|r0|v3|unstable)/login$"
561477 - " /_matrix/client/(api/v1|r0|v3|unstable)/logout(/all)?$"
562478 - " /_matrix/client/(r0|v3|unstable)/refresh$"
563- # these routes implicitly go to main via masterRoutes catch-all:
564- # - "/_matrix/client/(api/v1|r0|v3|unstable)/knock/" workers.md:284, knock.py:49
565- # - "/_matrix/client/(api/v1|r0|v3|unstable)/join/" workers.md:283
566- # - "/_matrix/client/unstable/org.matrix.msc4140/delayed_events(/.*/restart)?$" workers.md:291
567- # - "/_matrix/client/unstable/im.nheko.summary/summary/.*$" workers.md:241
568- # - "/_synapse/admin/v1/rooms/[^/]+$" workers.md:260
569- # - "/_matrix/client/unstable/org.matrix.msc3983/keys/claim$" keys.py:473 (not in workers.md)
570- # - "/_matrix/client/unstable/io.element.msc4388/rendezvous$" rendezvous.py:74 (msc4388_enabled: false by default)
571- # when experimental_features.msc3861.enabled (MAS) - these can go to a worker:
572- # TODO: decide if worker needed
573- # msc3861Routes:
574- # - "/_synapse/admin/v2/users/[^/]+$"
575- # - "/_synapse/admin/v1/username_available$"
576- # - "/_synapse/admin/v1/users/[^/]+/_allow_cross_signing_replacement_without_uia$"
577- # - "/_synapse/admin/v1/users/[^/]+/devices$"
578479
579480admin :
580481 ingress :
0 commit comments