Created
June 2, 2014 13:57
-
-
Save erkiesken/c34b0d7d1c1d847efa4f to your computer and use it in GitHub Desktop.
haproxy local node dev
This file contains 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
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