2015-02-24 16:19:02 -05:00
|
|
|
#
|
|
|
|
# Example pillar configuration
|
|
|
|
#
|
|
|
|
|
|
|
|
haproxy:
|
2015-07-13 05:14:51 -04:00
|
|
|
enabled: True
|
2015-03-17 05:16:55 -04:00
|
|
|
config_file_path: /etc/haproxy/haproxy.cfg
|
2015-02-24 16:19:02 -05:00
|
|
|
global:
|
|
|
|
stats:
|
|
|
|
enable: True
|
|
|
|
socketpath: /var/lib/haproxy/stats
|
2015-12-11 17:40:42 -05:00
|
|
|
level: admin
|
2015-07-29 06:16:37 -04:00
|
|
|
ssl-default-bind-ciphers: "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384"
|
|
|
|
ssl-default-bind-options: "no-sslv3 no-tlsv10 no-tlsv11"
|
2015-02-24 16:19:02 -05:00
|
|
|
|
|
|
|
user: haproxy
|
|
|
|
group: haproxy
|
|
|
|
chroot:
|
|
|
|
enable: True
|
|
|
|
path: /var/lib/haproxy
|
|
|
|
|
|
|
|
daemon: True
|
|
|
|
|
2015-08-30 16:36:01 -04:00
|
|
|
|
|
|
|
userlists:
|
|
|
|
userlist1:
|
|
|
|
users:
|
|
|
|
john: insecure-password doe
|
|
|
|
sam: insecure-password frodo
|
|
|
|
# groups:
|
|
|
|
# admins: users john sam
|
|
|
|
# guests: users jekyll hyde jane
|
|
|
|
|
2015-02-24 16:19:02 -05:00
|
|
|
defaults:
|
|
|
|
log: global
|
|
|
|
mode: http
|
|
|
|
retries: 3
|
|
|
|
options:
|
|
|
|
- httplog
|
|
|
|
- dontlognull
|
|
|
|
- forwardfor
|
|
|
|
- http-server-close
|
2015-09-23 09:05:07 -04:00
|
|
|
logformat: "%ci:%cp\\ [%t]\\ %ft\\ %b/%s\\ %Tq/%Tw/%Tc/%Tr/%Tt\\ %ST\\ %B\\ %CC\\ %CS\\ %tsc\\ %ac/%fc/%bc/%sc/%rc\\ %sq/%bq\\ %hr\\ %hs\\ %{+Q}r"
|
2015-02-24 16:19:02 -05:00
|
|
|
timeouts:
|
|
|
|
- http-request 10s
|
|
|
|
- queue 1m
|
|
|
|
- connect 10s
|
|
|
|
- client 1m
|
|
|
|
- server 1m
|
|
|
|
- http-keep-alive 10s
|
|
|
|
- check 10s
|
2015-08-17 16:40:55 -04:00
|
|
|
stats:
|
|
|
|
- enable
|
|
|
|
- uri: '/admin?stats'
|
|
|
|
- realm: 'Haproxy\ Statistics'
|
|
|
|
- auth: 'admin1:AdMiN123'
|
2015-02-24 16:19:02 -05:00
|
|
|
|
|
|
|
errorfiles:
|
|
|
|
400: /etc/haproxy/errors/400.http
|
|
|
|
403: /etc/haproxy/errors/403.http
|
|
|
|
408: /etc/haproxy/errors/408.http
|
|
|
|
500: /etc/haproxy/errors/500.http
|
|
|
|
502: /etc/haproxy/errors/502.http
|
|
|
|
503: /etc/haproxy/errors/503.http
|
|
|
|
504: /etc/haproxy/errors/504.http
|
|
|
|
|
2015-08-05 06:02:51 -04:00
|
|
|
{# Suported by HAProxy 1.6 #}
|
|
|
|
resolvers:
|
|
|
|
local_dns:
|
|
|
|
options:
|
|
|
|
- nameserver resolvconf 127.0.0.1:53
|
|
|
|
- resolve_retries 3
|
|
|
|
- timeout retry 1s
|
|
|
|
- hold valid 10s
|
|
|
|
|
2015-08-10 03:35:40 -04:00
|
|
|
|
2015-07-17 22:00:32 -04:00
|
|
|
listens:
|
|
|
|
stats:
|
|
|
|
bind:
|
|
|
|
- "0.0.0.0:8998"
|
|
|
|
mode: http
|
|
|
|
stats:
|
|
|
|
enable: True
|
|
|
|
uri: "/admin?stats"
|
|
|
|
refresh: "20s"
|
|
|
|
myservice:
|
|
|
|
bind:
|
|
|
|
- "*:8888"
|
|
|
|
options:
|
|
|
|
- forwardfor
|
|
|
|
- http-server-close
|
2015-07-17 23:37:56 -04:00
|
|
|
defaultserver:
|
|
|
|
slowstart: 60s
|
|
|
|
maxconn: 256
|
|
|
|
maxqueue: 128
|
|
|
|
weight: 100
|
2015-07-17 22:00:32 -04:00
|
|
|
servers:
|
|
|
|
web1:
|
|
|
|
host: web1.example.com
|
|
|
|
port: 80
|
|
|
|
check: check
|
|
|
|
web2:
|
|
|
|
host: web2.example.com
|
|
|
|
port: 18888
|
|
|
|
check: check
|
2016-01-15 04:34:05 -05:00
|
|
|
web3:
|
|
|
|
host: web3.example.com
|
2015-07-17 22:00:32 -04:00
|
|
|
|
2015-02-24 16:19:02 -05:00
|
|
|
frontends:
|
|
|
|
frontend1:
|
|
|
|
name: www-http
|
|
|
|
bind: "*:80"
|
2015-09-02 03:31:45 -04:00
|
|
|
redirects:
|
|
|
|
- scheme https if !{ ssl_fc }
|
2015-11-16 05:20:21 -05:00
|
|
|
reqadds:
|
2015-02-24 16:19:02 -05:00
|
|
|
- "X-Forwarded-Proto:\\ http"
|
|
|
|
default_backend: www-backend
|
|
|
|
|
2015-07-13 20:21:58 -04:00
|
|
|
www-https:
|
2015-02-24 16:19:02 -05:00
|
|
|
bind: "*:443 ssl crt /etc/ssl/private/certificate-chain-and-key-combined.pem"
|
2015-09-23 09:05:07 -04:00
|
|
|
logformat: "%ci:%cp\\ [%t]\\ %ft\\ %b/%s\\ %Tq/%Tw/%Tc/%Tr/%Tt\\ %ST\\ %B\\ %CC\\ %CS\\ %tsc\\ %ac/%fc/%bc/%sc/%rc\\ %sq/%bq\\ %hr\\ %hs\\ %{+Q}r\\ ssl_version:%sslv\\ ssl_cipher:%sslc"
|
2015-11-16 05:20:21 -05:00
|
|
|
reqadds:
|
2015-02-24 16:19:02 -05:00
|
|
|
- "X-Forwarded-Proto:\\ https"
|
|
|
|
default_backend: www-backend
|
|
|
|
acls:
|
|
|
|
- url_static path_beg -i /static /images /javascript /stylesheets
|
|
|
|
- url_static path_end -i .jpg .gif .png .css .js
|
|
|
|
use_backends:
|
2015-07-13 20:21:58 -04:00
|
|
|
- static-backend if url_static
|
2016-06-01 15:14:12 -04:00
|
|
|
extra: "rspadd Strict-Transport-Security:\ max-age=15768000"
|
2015-07-13 20:21:58 -04:00
|
|
|
some-services:
|
|
|
|
bind:
|
|
|
|
- "*:8080"
|
|
|
|
- "*:8088"
|
|
|
|
default_backend: api-backend
|
2015-02-24 16:19:02 -05:00
|
|
|
|
|
|
|
backends:
|
|
|
|
backend1:
|
|
|
|
name: www-backend
|
|
|
|
balance: roundrobin
|
2015-09-02 03:31:45 -04:00
|
|
|
redirects:
|
|
|
|
- scheme https if !{ ssl_fc }
|
2016-06-01 15:14:12 -04:00
|
|
|
extra: "reqidel ^X-Forwarded-For:"
|
2015-02-24 16:19:02 -05:00
|
|
|
servers:
|
|
|
|
server1:
|
|
|
|
name: server1-its-name
|
|
|
|
host: 192.168.1.213
|
2015-05-20 10:12:43 -04:00
|
|
|
port: 80
|
2015-02-24 16:19:02 -05:00
|
|
|
check: check
|
2015-07-13 20:21:58 -04:00
|
|
|
static-backend:
|
2015-02-24 16:19:02 -05:00
|
|
|
balance: roundrobin
|
2015-09-02 03:31:45 -04:00
|
|
|
redirects:
|
|
|
|
- scheme https if !{ ssl_fc }
|
2015-05-20 10:12:43 -04:00
|
|
|
options:
|
|
|
|
- http-server-close
|
|
|
|
- httpclose
|
|
|
|
- forwardfor except 127.0.0.0/8
|
|
|
|
- httplog
|
|
|
|
cookie: "pm insert indirect"
|
|
|
|
stats:
|
|
|
|
enable: True
|
|
|
|
uri: /url/to/stats
|
|
|
|
realm: LoadBalancer
|
|
|
|
auth: "user:password"
|
2015-02-24 16:19:02 -05:00
|
|
|
servers:
|
2015-07-13 20:21:58 -04:00
|
|
|
some-server:
|
2015-02-24 16:19:02 -05:00
|
|
|
host: 123.156.189.111
|
|
|
|
port: 8080
|
2015-03-17 05:16:55 -04:00
|
|
|
check: check
|
2016-01-15 04:34:05 -05:00
|
|
|
another-server:
|
|
|
|
host: 123.156.189.112
|
2015-07-13 20:21:58 -04:00
|
|
|
api-backend:
|
|
|
|
options:
|
|
|
|
- http-server-close
|
|
|
|
- forwardfor
|
|
|
|
servers:
|
|
|
|
apiserver1:
|
|
|
|
host: apiserver1.example.com
|
|
|
|
port: 80
|
|
|
|
check: check
|
|
|
|
server2:
|
|
|
|
name: apiserver2
|
|
|
|
host: apiserver2.example.com
|
|
|
|
port: 80
|
|
|
|
check: check
|
2015-08-05 06:02:51 -04:00
|
|
|
extra: resolvers local_dns resolve-prefer ipv4
|
2015-08-10 03:35:40 -04:00
|
|
|
another_www:
|
|
|
|
mode: tcp
|
|
|
|
balance: source
|
|
|
|
sticktable: "type binary len 32 size 30k expire 30m"
|
|
|
|
acls:
|
|
|
|
- clienthello req_ssl_hello_type 1
|
|
|
|
- serverhello rep_ssl_hello_type 2
|
|
|
|
tcprequests:
|
|
|
|
- "inspect-delay 5s"
|
|
|
|
- "content accept if clienthello"
|
|
|
|
tcpresponses:
|
|
|
|
- "content accept if serverhello"
|
|
|
|
stickons:
|
|
|
|
- "payload_lv(43,1) if clienthello"
|
2015-08-17 16:40:55 -04:00
|
|
|
reqrep:
|
|
|
|
- "^([^\ :]*)\ /static/(.*) \1\ \2"
|
2015-08-10 03:35:40 -04:00
|
|
|
options: "ssl-hello-chk"
|