I'm struggling to find an answer, is it possible de convert an Nginx map like below to Apache2 (2.4) equivalent ?
server {
[...]
location ~* ^(/_matrix|/_synapse) {
proxy_pass http://$matrix_worker_upstream$request_uri;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
client_max_body_size 50M;
proxy_http_version 1.1;
}
[...]
}
upstream synapse {
server 127.0.0.1:8008;
}
upstream generic-worker {
ip_hash;
server 127.0.0.1:8008;
server 127.0.0.1:8081;
}
upstream media_repository {
server 127.0.0.1:8085;
}
map $uri $matrix_worker_upstream {
default synapse;
~^/_matrix/client/(r0|v3)/sync$ generic-worker;
~^/_matrix/client/(api/v1|r0|v3)/events$ generic-worker;
~^/_matrix/client/(api/v1|r0|v3)/initialSync$ generic-worker;
~^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$ generic-worker;
[...]
}
If i understand well, upstreams can be converted to proxy balancer like this ?
<Proxy balancer://generic-worker>
BalancerMember http://127.0.0.1:8080
BalancerMember http://127.0.0.1:8081
</Proxy>
But i don't see how to convert the map part ? (there are loads of urls inside map)
For information, this is a configuration for Synapse (Matrix) with workers. And why Apache2 ? This is for avoid extra configuration for Shibboleth with Matrix.
Here is what i got, seems to work even if other errors heads up ...
Upstreams convert to proxy balancer but each map element are converted into proxypass rules. There should be a way to shorten this though ...
Also, Apache mods need to be enabled :