From 3d8cb479e3936a6a02a4d7e8c033af47acef33d4 Mon Sep 17 00:00:00 2001 From: Nikolay Kopitonenko Date: Wed, 14 Aug 2024 23:28:18 +0300 Subject: [PATCH] =?UTF-8?q?/etc/haproxy/haproxy.cfg:=20=D0=BD=D0=B5=20?= =?UTF-8?q?=D1=81=D0=BB=D1=83=D1=88=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=80=D1=82=2080=20=D0=B8=20443?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etc/haproxy/haproxy.cfg | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 etc/haproxy/haproxy.cfg diff --git a/etc/haproxy/haproxy.cfg b/etc/haproxy/haproxy.cfg new file mode 100644 index 0000000..9b885ac --- /dev/null +++ b/etc/haproxy/haproxy.cfg @@ -0,0 +1,48 @@ +global + maxconn 4096 + user haproxy + group haproxy + log /dev/log local1 debug + tune.ssl.default-dh-param 2048 + +defaults + log global + mode http + compression algo gzip + option httplog + option dontlognull + retries 3 + option redispatch + option http-server-close + option forwardfor + maxconn 2000 + timeout connect 5s + timeout client 15min + timeout server 15min + +frontend public + bind :::3030 v4v6 + option forwardfor except 127.0.0.1 + use_backend webcam if { path_beg /webcam/ } + use_backend webcam_hls if { path_beg /hls/ } + use_backend webcam_hls if { path_beg /jpeg/ } + default_backend octoprint + +backend octoprint + acl needs_scheme req.hdr_cnt(X-Scheme) eq 0 + + http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2 + http-request add-header X-Scheme https if needs_scheme { ssl_fc } + http-request add-header X-Scheme http if needs_scheme !{ ssl_fc } + option forwardfor + server octoprint1 127.0.0.1:5000 + errorfile 503 /etc/haproxy/errors/503-no-octoprint.http + +backend webcam + http-request replace-path /webcam/(.*) /\1 + server webcam1 127.0.0.1:8080 + errorfile 503 /etc/haproxy/errors/503-no-webcam.http + +backend webcam_hls + server webcam_hls_1 127.0.0.1:28126 + errorfile 503 /etc/haproxy/errors/503-no-webcam-hls.http