cam haproxy work

This commit is contained in:
paukstelis
2022-12-23 15:48:11 -05:00
parent 84a82ebafd
commit 278877c2c4

View File

@@ -270,15 +270,13 @@ new_instance () {
echo "#$INSTANCE start" >> /etc/haproxy/haproxy.cfg echo "#$INSTANCE start" >> /etc/haproxy/haproxy.cfg
echo "backend $INSTANCE" >> /etc/haproxy/haproxy.cfg echo "backend $INSTANCE" >> /etc/haproxy/haproxy.cfg
if [ $HAversion -gt 1 ]; then if [ $HAversion -gt 1 ]; then
/bin/sh "cat >> /etc/haproxy/haproxy.cfg" << PROX echo " http-request replace-path /$INSTANCE/(.*) /\1" >> /etc/haproxy/haproxy.cfg
http-request replace-path /$INSTANCE/(.*) /\1 echo " acl needs_scheme req.hdr_cnt(X-Scheme) eq 0" >> /etc/haproxy/haproxy.cfg
acl needs_scheme req.hdr_cnt(X-Scheme) eq 0 echo " http-request add-header X-Scheme https if needs_scheme { ssl_fc }" >> /etc/haproxy/haproxy.cfg
http-request add-header X-Scheme https if needs_scheme { ssl_fc } echo " http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }" >> /etc/haproxy/haproxy.cfg
http-request add-header X-Scheme http if needs_scheme !{ ssl_fc } echo " http-request add-header X-Script-Name /$INSTANCE" >> /etc/haproxy/haproxy.cfg
http-request add-header X-Script-Name /$INSTANCE echo " server octoprint1 127.0.0.1:$PORT" >> /etc/haproxy/haproxy.cfg
server octoprint1 127.0.0.1:$PORT echo " option forwardfor" >> /etc/haproxy/haproxy.cfg
option forwardfor
PROX
else else
echo " reqrep ^([^\ :]*)\ /$INSTANCE/(.*) \1\ /\2" >> /etc/haproxy/haproxy.cfg echo " reqrep ^([^\ :]*)\ /$INSTANCE/(.*) \1\ /\2" >> /etc/haproxy/haproxy.cfg
echo " server octoprint1 127.0.0.1:$PORT" >> /etc/haproxy/haproxy.cfg echo " server octoprint1 127.0.0.1:$PORT" >> /etc/haproxy/haproxy.cfg
@@ -411,7 +409,7 @@ add_camera() {
fi fi
#for now just set a flag that we are going to write cameras behind haproxy #for now just set a flag that we are going to write cameras behind haproxy
if [ "$HAPROXY" == true ]; then if [ "$HAPROXY" == true ]; then
if prompt_confirm "Add cameras behind haproxy?"; then if prompt_confirm "Add cameras to haproxy?"; then
CAMHAPROXY=1 CAMHAPROXY=1
fi fi
fi fi