title: Configuring HAProxy in docker (503 Service Unavailable)
body: <p>I create an Octoprint container to control my printer, and it works fine.
  Now I want to have secure access to it from anywhere. To do this, I use HAProxy.<br>
  However, after authorization, HAProxy returns the StatusCode 503, and I can't fix that.<br>
  Here are the docker files and configuration file:</p>
  <p><strong>docker-compose.yml</strong></p>
  <pre><code>version: &quot;2.5&quot;
  
  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: bridge
  </code></pre>
  <p><strong>haproxy\haproxy.cfg</strong></p>
  <pre><code>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 Password
  </code></pre>
  <p><strong>haproxy\Dockerfile</strong></p>
  <pre><code>FROM haproxy:latest
  COPY haproxy/haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
  </code></pre>