Skip to content

Commit 67b1314

Browse files
committed
proxmox: allow consoles to also be load balance reverse proxied
1 parent ee76ef2 commit 67b1314

File tree

1 file changed

+21
-10
lines changed
  • files/etc/apache2.webserver.ext/sites-enabled

1 file changed

+21
-10
lines changed

files/etc/apache2.webserver.ext/sites-enabled/2-pve.conf

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@
6565
<IfModule mod_proxy_balancer.c>
6666

6767
<Proxy "balancer://pvecluster">
68-
BalancerMember "https://pve1:8006"
69-
BalancerMember "https://pve2:8006" loadfactor=2
70-
BalancerMember "https://pve3:8006" loadfactor=5
68+
BalancerMember "https://pve1:8006" route=1 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900 upgrade=websocket
69+
BalancerMember "https://pve2:8006" route=2 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900 upgrade=websocket loadfactor=2
70+
BalancerMember "https://pve3:8006" route=3 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900 upgrade=websocket loadfactor=5
71+
ProxySet stickysession=ROUTEID
72+
# ProxySet lbmethod=byrequests
7173
</Proxy>
7274

7375
</IfModule>
@@ -80,19 +82,28 @@
8082

8183
SSLProxyEngine On
8284

83-
SetEnv force-proxy-request-1.0 1
84-
SetEnv proxy-nokeepalive 1
85+
# don't know the original author's motivation for saying force-proxy-request-1.0, but it seems to be incompatible with websocket proxies
86+
#SetEnv force-proxy-request-1.0 1
87+
#SetEnv proxy-nokeepalive 1
8588

8689
SSLProxyVerify none
8790
SSLProxyCheckPeerCN off
8891
SSLProxyCheckPeerName off
8992
SSLProxyCheckPeerExpire off
9093

91-
# a lot of this config came
92-
# from https://forum.proxmox.com/threads/config-dump-apache-load-balancer-fail-over-and-reverse-proxy.131217/
93-
# but some straight from https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyrequests
94-
ProxyPass "/" "balancer://pvecluster/" stickysession=JSESSIONID|jsessionid nofailover=On
95-
ProxyPassReverse "/" "balancer://pvecluster/"
94+
<Location / >
95+
96+
# Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/; HttpOnly" env=BALANCER_ROUTE_CHANGED
97+
98+
# a lot of this config came
99+
# from https://forum.proxmox.com/threads/config-dump-apache-load-balancer-fail-over-and-reverse-proxy.131217/
100+
# but some straight from https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyrequests
101+
# The combination of reverseproxy, load balancer, sticky sessions is not very well documented,
102+
# and I ended up adapting this: https://vaadin.com/docs/latest/flow/production/reverse-proxy
103+
ProxyPass "balancer://pvecluster/" stickysession=ROUTEID nofailover=On
104+
# upgrade=websocket
105+
ProxyPassReverse "balancer://pvecluster/"
106+
</Location>
96107

97108
</IfModule>
98109

0 commit comments

Comments
 (0)