Skip to content

Instantly share code, notes, and snippets.

@derhuerst
Last active June 21, 2020 14:13
Show Gist options
  • Save derhuerst/af56c0d5db96758bb6dcf0aac63437c9 to your computer and use it in GitHub Desktop.
Save derhuerst/af56c0d5db96758bb6dcf0aac63437c9 to your computer and use it in GitHub Desktop.
2.vbb.transport.rest unfinished haproxy config
# https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-http-load-balancing-on-an-ubuntu-vps
global
daemon
maxconn 256
tune.ssl.default-dh-param 4096
log 127.0.0.1 local0 debug
defaults
mode http
timeout connect 5s
timeout client 20s
timeout server 20s
frontend vbb-rest:in:http
bind *:80
redirect scheme https code 301 if !{ ssl_fc }
frontend vbb-rest:in:https
bind *:443 ssl crt /etc/haproxy/fig.jannisr.de.pem
default_backend vbb-rest:out
backend vbb-rest:out
server julius 2.vbb.juliustens.eu:443 check check-ssl ca-file /etc/haproxy/root-cas.pem observe layer7 error-limit 10 fall 2 rise 1 resolvers cloudflare
server now1 vbb-rest-ribczgxrzz.now.sh:443 check check-ssl ca-file /etc/haproxy/root-cas.pem observe layer7 error-limit 10 fall 2 rise 1 inter 60s fastinter 10s downinter 30s resolvers cloudflare
option forwardfor
http-request add-header X-Forwarded-Proto https if { ssl_fc }
# todo proper health check
http-send-name-header Host
# option httpchk GET / HTTP/1.1\r\nHost:localhost
resolvers cloudflare
nameserver cloudflare1 1.1.1.1:53
nameserver cloudflare2 2606:4700:4700::1111:53
nameserver cloudflare3 1.0.0.1:53
nameserver cloudflare4 2606:4700:4700::1001:53
hold valid 1m
frontend stats
bind *:8080 ssl crt /etc/haproxy/fig.jannisr.de.pem
stats enable
stats uri /
cat /etc/ssl/certs/*.pem >/etc/haproxy/root-cas.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment