@@ -434,7 +434,7 @@ ingress:
434434 - " /_matrix/client/(unstable|v1)/org.matrix.msc4108/rendezvous$"
435435 - " /_synapse/client/rendezvous$"
436436 # federation overrides to main/master process
437- - " /_matrix/federation/v1/openid/userinfo$"
437+ # - "/_matrix/federation/v1/openid/userinfo$"
438438 # send all other traffic to the main/master process, should go last in lb config
439439 masterRoutes :
440440 - " /_matrix/"
@@ -576,8 +576,15 @@ ingress:
576576 # source: no specific password_policy file found; workers.md:276 documents (r0|v3|unstable)
577577 - " /_matrix/client/(r0|v3|unstable)/password_policy$"
578578 federationReaderRoutes :
579- # broad pattern - must be LAST to avoid shadowing more specific routes above
580- - " /_matrix/(federation/(v1|v2)|key/v2)/"
579+ # original:
580+ # - "/_matrix/(federation/(v1|v2)|key/v2)/"
581+ # NGINX ingress sorts ImplementationSpecific regex paths by string length (longer = higher priority).
582+ # This pattern (56 chars) is tried before shorter routes, so negative lookaheads are required to
583+ # prevent shadowing:
584+ # - (?!/(media|openid)) excludes:
585+ # /_matrix/federation/v1/media/ (29 chars) → must go to synapse-media-repository
586+ # /_matrix/federation/v1/openid/ (37 chars) → must go to synapse-master (masterOverridesRoutes)
587+ - " /_matrix/(federation/(v1|v2)(?!/(media|openid))|key/v2)/"
581588 # enabled if MAS is enabled, mutually exclusive with clientReaderRegister
582589 # source: login.py:76,588 logout.py:38,65
583590 # Fixed: explicit version prefixes instead of greedy (.*) to avoid matching subpaths unexpectedly
0 commit comments