Hello,
I am complete Newbe in HAPROXY and want to use is to redirect Websocket requests coming via port 80 to a different port 8181 on which a custom Websocket-Server is listening. All is supposed to work on the same mashine,
haproxy, Apache and the websocket Server.
I installed haproxy in Version 1.5.8 straight from the Debian 8 repositories.
The Apache Port is reconfigured from Port 80 to 8000. This works.
A properly working Websocket-Call is ws://:8181/demo
My idea is haproxy the websocket calls to ws:///demo to ws://:8181/demo
and to haproxy the Standard http-calls on port 80 to the Apache 8000.
While the Apache-hapoxy-config part seems to be fine, the ws-configuration sucks. I am not sure why and do not know really how to debug.
I was assuming that the line
option http-server-close
from a configuration sample I found would be important but with this line the Service does not start. It Fails with
haproxy.service start request repeated too quickly, refusing to start.
<<
Here is the complete config:
(a check via haproxy -c -f haproxy.cfg does not show errors)
Haproxy Konfig fuer Websockets
Berner Telecom-Dienste (c) 2018
Achtung: Die Einrueckungen sind TABs!!
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 2000
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
option http-server-close
defaults
log global
mode http
option httplog
option dontlognull
retries 3
maxconn 2000
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend public
bind *:80
acl is_websocket hdr(Upgrade) -i WebSocket
acl is_websocket_server hdr_end(host) -i primus0.de/demo:8181
use_backend ws if is_websocket is_websocket_server
default_backend www
backend www
timeout server 30s
server www1 127.0.0.1:8000
backend ws
timeout server 600s
server ws1 127.0.0.1:8181
Any idea how to overcome this?
Best regards
Wuppi