Skip to content

Instantly share code, notes, and snippets.

@jaymecd
Forked from lpirola/haproxy.conf
Created December 30, 2015 00:42
Show Gist options
  • Save jaymecd/e3657236c059fd9e4148 to your computer and use it in GitHub Desktop.
Save jaymecd/e3657236c059fd9e4148 to your computer and use it in GitHub Desktop.
Haproxy configuration file example, serving a golang service listening at port 3001. Its forced to response only SSL connections
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local0
maxconn 10000
uid 99
gid 99
daemon
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
timeout connect 5000
timeout client 50000
timeout server 50000
frontend http
bind *:80
bind *:443 ssl crt /etc/ssl/key.pem
redirect scheme https if !{ ssl_fc }
acl is_stats hdr(host) -i hastats.localhost
use_backend stats if is_stats
default_backend myapp
capture request header Host len 20
capture request header Referer len 50
backend myapp
mode http
server main 127.0.0.1:3001
backend stats
mode http
stats enable
stats scope http
stats scope myapp
stats realm Haproxy\ Statistics
stats uri /
stats auth username:password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment