Skip to content

Instantly share code, notes, and snippets.

@jweyrich
Last active June 23, 2024 04:07
Show Gist options
  • Save jweyrich/5368162e084f1f2fde8aab0353681db4 to your computer and use it in GitHub Desktop.
Save jweyrich/5368162e084f1f2fde8aab0353681db4 to your computer and use it in GitHub Desktop.
HAproxy forwarding to https backend
#
# This is just a snippet of HAProxy config.
# Please replace ENTRY_DOMAIN_HERE and TARGET_DOMAIN_HERE accordingly.
#
frontend front_http
log global
bind :80
use_backend back_target if { hdr(host) -i ENTRY_DOMAIN_HERE }
default_backend back_healthcheck
backend back_target
mode http
log global
option forwardfor
http-request set-header host TARGET_DOMAIN_HERE
server back_server TARGET_DOMAIN_HERE:443 ssl verify none sni str(TARGET_DOMAIN_HERE)
http-request return status 200 content-type "text/plain" lf-string "back_target reply" if { path -i -m beg /health/ }
backend back_healthcheck
mode http
#http-request deny deny_status 400
http-request return status 200 content-type "text/plain" lf-string "alive"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment