我们想在侦听KVM上不同端口的两个进程之间实现请求负载均衡。
当我将URL直接放在RewriteRule中而不进行负载平衡时,一切似乎都可以正常工作。所以我认为我的配置有问题。
我的配置是:
<IfModule mod_ssl.c>
<virtualHost :443>
ServerName super.secret.domain
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://httprewrite>
BalancerMember http://192.168.122.83:81/$1 route=1
BalancerMember http://192.168.122.83:80/$1 route=2
ProxySet stickysession=ROUTEID
</Proxy>
<Proxy balancer://wsrewrite>
BalancerMember ws://192.168.122.83:81/$1 route=1
BalancerMember ws://192.168.122.83:80/$1 route=2
ProxySet stickysession=ROUTEID
</Proxy>
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.) balancer://wsrewrite/ [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) balancer://httprewrite/ [P,L]
SSLCertificateFile /etc/letsencrypt/live/super.secret.domain/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/super.secret.domain/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/super.secret.domain/chain.pem
</virtualHost>
</IfModule>
某些零件未装载其他零件。例如https://super.secret.domain/favicon.ico给出404错误。