Skip to content

Instantly share code, notes, and snippets.

@boina-n
Created April 8, 2017 13:13
Show Gist options
  • Save boina-n/dcdef7c80cbd7bd23b7dcacf28822c81 to your computer and use it in GitHub Desktop.
Save boina-n/dcdef7c80cbd7bd23b7dcacf28822c81 to your computer and use it in GitHub Desktop.
HaProxy conf for Cloud Foundry
defaults
mode http
log global
log 127.0.0.1 local2
option tcplog
option dontlognull
option http-server-close
option forwardfor
option redispatch
retries 3
maxconn 3000
timeout connect 5s
timeout client 25s
timeout server 25s
# Incoming requests in HTTP
#---------------------------------------------------------------------
frontend frontend-http
bind 192.168.0.201:80
mode http
acl is_sys hdr_end(host) -i sys.boina.fr
acl is_apps hdr_end(host) -i apps.boina.fr
use_backend pcfdev80 if is_sys or is_apps
# incoming requests in HTTPS and wss (websocket)
#---------------------------------------------------------------------
frontend frontend-https
bind 192.168.0.201:443 ssl crt /etc/haproxy/certificats/pcfdev.mydomain.pem
mode http
reqadd X-Forwarded-Proto:\ https
acl is_websocket hdr(Upgrade) -i WebSocket
acl is_for_pcf hdr_dom(host) -i sys.boina.fr
acl is_for_doppler hdr(host) -i doppler.sys.boina.fr:443
acl is_for_uaa hdr(host) -i uaa.sys.boina.fr:443
acl is_for_apps hdr_dom(host) -i apps.boina.fr
use_backend wss if is_websocket
use_backend pcfdev443 if is_for_pcf or is_for_uaa or is_for_apps or is_for_doppler
# incoming SSH (port 2222)
#---------------------------------------------------------------------
frontend frontend-ssh2222
bind 192.168.0.201:2222
mode tcp
use_backend ssh2222
# PCFDev Backends
#---------------------------------------------------------------------
backend pcfdev80
mode http
server static 192.168.11.11:80 check
backend pcfdev443
mode http
server static 192.168.11.11:443 check ssl verify none
backend wss
mode http
server ws1 192.168.11.11:443 check ssl verify none
backend ssh2222
mode tcp
server ws1 192.168.11.11:2222 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment