Skip to content

Instantly share code, notes, and snippets.

@erkiesken
Created June 2, 2014 13:57
Show Gist options
  • Save erkiesken/c34b0d7d1c1d847efa4f to your computer and use it in GitHub Desktop.
Save erkiesken/c34b0d7d1c1d847efa4f to your computer and use it in GitHub Desktop.
haproxy local node dev
global
daemon
maxconn 256
defaults
log global
maxconn 256
mode http
option forwardfor
option http-server-close
timeout connect 5s
timeout client 30s
timeout server 30s
timeout tunnel 1h
option forceclose
frontend public
# HTTP
bind 127.0.0.1:80
# HTTPS
bind 127.0.0.1:443 ssl crt /path/to/mydomainwildcardcert.pem
# Add the https proto header
reqadd x-forwarded-proto:\ https if { ssl_fc }
option forwardfor
# Redirect all HTTP traffic to HTTPS
redirect scheme https if !{ ssl_fc }
# Default to Node frontend app
default_backend node_app
# Send all api.* requests to API based on URL match
acl api_server hdr_beg(host) -i api.
use_backend node_api if api_server
# Frontend Node app
backend node_app
server app1 127.0.0.1:8666
# API Node app
backend node_api
server api1 127.0.0.1:8081
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment