-
-
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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