-
-
Save si9ma/6e6b1aac9d0c1e84170483f2478e52f8 to your computer and use it in GitHub Desktop.
Sample haproxy config
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
##based on Mesosphere Marathon's servicerouter.py haproxy config | |
global | |
daemon | |
log 127.0.0.1 local0 | |
log 127.0.0.1 local1 notice | |
maxconn 4096 | |
tune.ssl.default-dh-param 2048 | |
defaults | |
log global | |
retries 3 | |
maxconn 2000 | |
timeout connect 5s | |
timeout client 50s | |
timeout server 50s | |
listen stats | |
bind 127.0.0.1:9090 | |
balance | |
mode http | |
stats enable | |
stats auth admin:admin | |
frontend microservice_http_in | |
bind *:80 | |
mode http | |
frontend microservice_http_appid_in | |
bind *:81 | |
mode http | |
acl app__accountCreationService hdr(x-microservice-app-id) -i /accountCreationService | |
acl app__profileEditingService hdr(x-microservice-app-id) -i /profileEditingService | |
use_backend accountCreationService_10000 if app__accountCreationService | |
use_backend profileEditingService_20000 if app__profileEditingService | |
frontend microservice_https_in | |
bind *:443 ssl crt /etc/ssl/yourCertificate | |
mode http | |
frontend accountCreationService_10000 | |
bind *:10000 | |
mode http | |
use_backend accountCreationService_10000 | |
frontend profileEditingService_20000 | |
bind *:20000 | |
mode http | |
use_backend profileEditingService_20000 | |
backend profileEditingService_20000 | |
balance roundrobin | |
mode http | |
option forwardfor | |
http-request set-header X-Forwarded-Port %[dst_port] | |
http-request add-header X-Forwarded-Proto https if { ssl_fc } | |
server 151_256_250_152_35900 151.256.250.152:35900 | |
# additional servers here | |
backend accountCreationService_10000 | |
balance roundrobin | |
mode http | |
option forwardfor | |
http-request set-header X-Forwarded-Port %[dst_port] | |
http-request add-header X-Forwarded-Proto https if { ssl_fc } | |
server 101_206_200_192_31900 101.206.200.192:31900 | |
# additional servers here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment