我创建一个Octoprint容器来控制我的打印机,它可以正常工作。现在我想从任何地方安全地访问它。为此,我使用HAProxy。
但是,在授权之后,HAProxy返回StatusCode 503,我无法修复这个问题。
下面是停靠文件和配置文件:
docker-compose.yml
version: "2.5"
services:
haproxy:
build:
context: .
dockerfile: haproxy/Dockerfile
container_name: haproxy
image: haproxy:latest
restart: always
volumes:
- haproxy_conf:/usr/local/etc/haproxy/
ports:
- 80:80
depends_on:
- octoprint
networks:
- haproxy_net
octoprint:
restart: unless-stopped
image: octoprint/octoprint
container_name: octoprint
ports:
- 5521:80
networks:
- haproxy_net
volumes:
- octoprint:/octoprint
volumes:
haproxy_conf:
octoprint:
networks:
haproxy_net:
driver: bridgehaproxy\haproxy.cfg
global
maxconn 4096
user haproxy
group haproxy
daemon
log 127.0.0.1 local1 debug
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
option http-server-close
option forwardfor
maxconn 2000
timeout connect 5s
timeout client 15m
timeout server 15m
frontend public
bind *:80 v4v6
default_backend octoprint
backend octoprint
http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2
option forwardfor
server octoprint1 octoprint:5521
acl AuthOkay http_auth(L1)
http-request auth realm octoprint if !AuthOkay
userlist L1
user UserName insecure-password Passwordhaproxy\Dockerfile
FROM haproxy:latest
COPY haproxy/haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg发布于 2022-09-01 16:32:07
您所使用的配置指令在八达通中捆绑的旧HAProxy 1.8版本中不受支持。
特别是http-request replace-path。replace-path是在HAproxy 2.1或2.2中引入的。因此,您需要在您的配置工作之前升级它。
我已经为RPi的ARM架构寻找了一段时间的预构建haproxy 2.2+二进制文件,但我认为这取决于自己构建它。我将在不久的某个时候尝试2.4,因为ARM构建支持存在于HAproxy源代码中。
https://stackoverflow.com/questions/71637290
复制相似问题