Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Forked from lackac/haproxy.cfg
Created January 8, 2019 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ilgrim/7eea518688870989c1680415b82fe49a to your computer and use it in GitHub Desktop.
Save Ilgrim/7eea518688870989c1680415b82fe49a to your computer and use it in GitHub Desktop.
HAProxy configuration with Websocket support
global
maxconn 4096 # Total Max Connections. This is dependent on ulimit
nbproc 2
log 127.0.0.1 local1 notice
defaults
mode http
log global
frontend all 0.0.0.0:80
timeout client 86400000
default_backend www_backend
acl is_websocket hdr(Upgrade) -i WebSocket
acl is_websocket hdr_beg(Host) -i ws
acl host_bibliaolvaso hdr_sub(Host) -i bibliaolvaso.hu
acl host_todomvc hdr_sub(Host) -i todomvc
use_backend bibliaolvaso_backend if is_websocket host_bibliaolvaso
use_backend todomvc_backend if is_websocket host_todomvc
backend www_backend
balance roundrobin
option forwardfor # This sets X-Forwarded-For
timeout server 86400000
timeout connect 4000
server nginx localhost:81
backend bibliaolvaso_backend
balance roundrobin
option forwardfor # This sets X-Forwarded-For
timeout queue 5000
timeout server 86400000
timeout connect 5000
server bibliaolvaso localhost:7777
backend todomvc_backend
balance roundrobin
option forwardfor # This sets X-Forwarded-For
timeout queue 5000
timeout server 86400000
timeout connect 5000
server todomvc localhost:3003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment