Skip to content

Instantly share code, notes, and snippets.

@TJkrusinski
Last active June 19, 2018 10:10
Show Gist options
  • Save TJkrusinski/6323990 to your computer and use it in GitHub Desktop.
Save TJkrusinski/6323990 to your computer and use it in GitHub Desktop.
HAProxy SSL Setup Redirect non HTTPS traffic to HTTPS and terminate SSL
# Basic file, has no logging or anything else setup
global
maxconn 20000
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
option forwardfor
option http-server-close
# Long timeout for websockets
timeout tunnel 1h
frontend http-in
bind *:80
# redirect http to https
redirect scheme https if !{ ssl_fc }
# Use path to your pem file
# pem file is made up of key file >> cert file >> bundle.pem
# Do some crap to your gd_bundle.crt file
# openssl x509 -in gd_bundle.crt -out gd_bundle.der -outform DER
# openssl x509 -in gd_bundle.der -out gd_bundle.pem -inform DER
bind *:443 ssl crt #pem
default_backend servers
backend servers
reqadd X-Forwarded-Proto:\ https
server #server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment