Probs to reach Octoprint web (propably haproxy misconfig issue)

What is the problem?
ERR_CONNECTION_REFUSED while accessing octoprint.local (http&https and tested on port 80/8080/5000)

What did you already try to solve it?
curl: (7) Failed to connect to localhost port 443: Verbindungsaufbau abgelehnt
curl: (7) Failed to connect to localhost port 80: Verbindungsaufbau abgelehnt
curl: (7) Failed to connect to localhost port 5000: --> some html output (good)

Logs (syslog, dmesg, ...)

journalctl - xe

Sep 25 20:23:17 octopi haproxy[1429]: [ALERT] 267/202317 (1429) : Fatal errors found in configuration.
Sep 25 20:23:17 octopi systemd[1]: haproxy.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- An ExecStartPre= process belonging to unit haproxy.service has exited.

-- The process' exit code is 'exited' and its exit status is 1.
Sep 25 20:23:17 octopi systemd[1]: haproxy.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- The unit haproxy.service has entered the 'failed' state with result 'exit-code'.
Sep 25 20:23:17 octopi systemd[1]: Failed to start HAProxy Load Balancer.
-- Subject: A start job for unit haproxy.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- A start job for unit haproxy.service has finished with a failure.

-- The job identifier is 879 and the job result is failed.
Sep 25 20:23:17 octopi systemd[1]: haproxy.service: Service RestartSec=100ms expired, scheduling restart.
Sep 25 20:23:17 octopi systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- Automatic restarting of the unit haproxy.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Sep 25 20:23:17 octopi systemd[1]: Stopped HAProxy Load Balancer.
-- Subject: A stop job for unit haproxy.service has finished
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- A stop job for unit haproxy.service has finished.

-- The job identifier is 939 and the job result is done.
Sep 25 20:23:17 octopi systemd[1]: haproxy.service: Start request repeated too quickly.
Sep 25 20:23:17 octopi systemd[1]: haproxy.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- The unit haproxy.service has entered the 'failed' state with result 'exit-code'.
Sep 25 20:23:17 octopi systemd[1]: Failed to start HAProxy Load Balancer.
-- Subject: A start job for unit haproxy.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- A start job for unit haproxy.service has finished with a failure.

-- The job identifier is 939 and the job result is failed.

HAPROXY.cfg

global
maxconn 4096
user haproxy
group haproxy
daemon
log 127.0.0.1 local1 debug
tune.ssl.default-dh-param 2048

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 15min
timeout server 15min

frontend public
bind :::80 v4v6
bind :::443 v4v6 ssl crt /home/pi/ssl/mydomain.com.pem ca-file /home/pi/ssl/OctoPrintCA.crt
option forwardfor except 127.0.0.1
scheme https code 301 if !{ ssl_fc }
use_backend webcam if { path_beg /webcam/ }
default_backend octoprint

backend octoprint
acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

    reqrep ^([^\ :]*)\ /(.*) \1\ /\2
    reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
    reqadd 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
reqrep ^([^\ :])\ /webcam/(.) \1\ /\2
server webcam1 127.0.0.1:8080
errorfile 503 /etc/haproxy/errors/503-no-webcam.http
global
maxconn 4096
user haproxy
group haproxy
daemon

Startup message in ssh

Traceback (most recent call last):
File "", line 1, in
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/init.py", line 6, in
import logging as log
File "/usr/lib/python2.7/logging/init.py", line 26, in
import sys, os, time, cStringIO, traceback, warnings, weakref, collections
File "/usr/lib/python2.7/weakref.py", line 14, in
from _weakref import (
ImportError: cannot import name _remove_dead_weakref


Access OctoPrint from a web browser on your network by navigating to any of:

http://octopi.local
http://192.168.2.112
http://[fd7d:10dc:6c4:1:ce72:4f62:21bf:e186]
http://[2003:ec:6bdd:1078:fb71:dbe4:e3bf:2f67]

https is also available, with a self-signed certificate.

OctoPrint version : unknown
OctoPi version : 0.16.0

status haproxy.service

pi@octopi:~ $ systemctl status haproxy.service
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-09-25 20:33:59 BST; 16s ago
Docs: man:haproxy(1)
file:/usr/share/doc/haproxy/configuration.txt.gz
Process: 1092 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=1/FAILURE)

Sep 25 20:33:59 octopi systemd[1]: haproxy.service: Service RestartSec=100ms expired, scheduling restart.
Sep 25 20:33:59 octopi systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Sep 25 20:33:59 octopi systemd[1]: Stopped HAProxy Load Balancer.
Sep 25 20:33:59 octopi systemd[1]: haproxy.service: Start request repeated too quickly.
Sep 25 20:33:59 octopi systemd[1]: haproxy.service: Failed with result 'exit-code'.
Sep 25 20:33:59 octopi systemd[1]: Failed to start HAProxy Load Balancer.

Additional information about your network (Hardware you are trying to connect to, hardware you are trying to connect from, router, access point, used operating systems, ...)

Connecting via Chrome from windows to raspi over wlan. Wlan (with ssh) works fine.

The /etc/haproxy/haproxy.cfg file probably needs formatting for it to work correctly. Here's mine:

global
        maxconn 4096
        user haproxy
        group haproxy
        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  15min
        timeout server  15min

frontend public
        bind :::80 v4v6
        bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem
        option forwardfor except 127.0.0.1
        use_backend webcam if { path_beg /webcam/ }
        default_backend octoprint

backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        reqrep ^([^\ :]*)\ /(.*) \1\ /\2
        reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        reqadd 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
        reqrep ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

I mved the current cfg. file and replaced it with the backup (which has standard format) - Service restarts also shows the error ...

● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-09-26 09:49:17 BST; 11s ago
Docs: man:haproxy(1)
file:/usr/share/doc/haproxy/configuration.txt.gz
Process: 1353 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=0/SUCCESS)
Process: 1354 ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $EXTRAOPTS (code=exited, status=1/FAILURE)
Main PID: 1354 (code=exited, status=1/FAILURE)

Sep 26 09:49:17 octopi systemd[1]: haproxy.service: Service RestartSec=100ms expired, scheduling restart.
Sep 26 09:49:17 octopi systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Sep 26 09:49:17 octopi systemd[1]: Stopped HAProxy Load Balancer.
Sep 26 09:49:17 octopi systemd[1]: haproxy.service: Start request repeated too quickly.
Sep 26 09:49:17 octopi systemd[1]: haproxy.service: Failed with result 'exit-code'.
Sep 26 09:49:17 octopi systemd[1]: Failed to start HAProxy Load Balancer.

I found a hint in https://discourse.haproxy.org/t/fails-to-start-haproxy/3881 that gives this output. tune.ssl can be changed, so that leaves the bindings as errors..

[WARNING] 268/095228 (1528) : Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to at least 2048. Please set a value >= 1024 to make this warning disappear.
[ALERT] 268/095228 (1528) : Starting frontend public: cannot bind socket [:::80]
[ALERT] 268/095228 (1528) : Starting frontend public: cannot bind socket [:::443]

sudo haproxy -db -f /etc/haproxy/haproxy.cfg & solved the problem. Octoprint is now running.
But only manually. It seems some rights are missing for the service. But i don´t know which exactly.
Can someone help me here, pls ?

I'm not really the expert with haproxy, I'm afraid. Anyone, anyone...?