anonymousland-synapse-docke.../DockerTODO/upstream
2022-12-07 16:59:16 -05:00

39 lines
1.0 KiB
Plaintext

upstream additional1_worker_lc {
least_conn;
server additional1:8081;
}
upstream sso_worker_lc {
least_conn;
server synapse-generic-worker-4:8081;
}
# extract username from token get parameter
map $arg_access_token $token_from_arg {
default $arg_access_token;
"~syt_(?<username>.*?)_.*" $username;
}
# extract username part from bearer token, fallback to access_token
map $http_authorization $proxy_username_label {
default $http_authorization;
"~Bearer syt_(?<username>.*?)_.*" $username;
"" $token_from_arg;
}
upstream sync_worker {
# pin with username extracted from bearer token or access_token
hash $proxy_username_label consistent;
server sync1:8081;
server sync2:8081;
server sync3:8081;
}
upstream sync_init {
# Use the username mapper result for hash key
hash $mxid_localpart consistent;
server sync4:8081;
server sync5:8081;
}