Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. global
  2. daemon
  3. #log /dev/log local0
  4. #log /dev/log local1 notice
  5. log /dev/log syslog debug
  6. pidfile /var/run/haproxy.pid
  7. nbproc 2 #no of processes
  8. maxconn 128000
  9. user haproxy
  10. group haproxy
  11. defaults
  12. log global
  13. option log-health-checks
  14. # make sure log-format is on a single line
  15. log-format {"type":"haproxy","timestamp":%Ts,"http_status":%ST,"http_request":"%r","remote_addr":"%ci","bytes_read":%B,"upstream_addr":"%si","backend_name":"%b","retries":%rc,"bytes_uploaded":%U,"upstream_response_time":"%Tr","upstream_connect_time":"%Tc","session_duration":"%Tt","termination_state":"%ts"}
  16. mode http
  17. option httplog
  18. option dontlognull
  19. option http-keep-alive
  20. option http-tunnel
  21. timeout connect 5000
  22. timeout client 50000
  23. timeout server 50000
  24. errorfile 400 /etc/haproxy/errors/400.http
  25. errorfile 403 /etc/haproxy/errors/403.http
  26. errorfile 408 /etc/haproxy/errors/408.http
  27. errorfile 500 /etc/haproxy/errors/500.http
  28. errorfile 502 /etc/haproxy/errors/502.http
  29. errorfile 503 /etc/haproxy/errors/503.http
  30. errorfile 504 /etc/haproxy/errors/504.http
  31. # the 1.1.1.1 ip address in the acl's below is a BODGE
  32. # it's there to make the GO template script easier
  33. # and will be removed when things are stabilised
  34. # :)
  35. frontend http-in
  36. bind *:8080
  37. acl permitted_ip src 10.0.0.1 10.0.0.2 81.157.241.158 80.4.177.237 81.150.38.177
  38. tcp-request inspect-delay 5s
  39. tcp-request connection reject if !permitted_ip
  40. # this should really be multiple acl statetments. large counts may overflow line buffer
  41. acl amazon_GB_users src 1.1.1.1 10.0.2.3 10.0.0.1
  42. # this should really be multiple acl statetments. large counts may overflow line buffer
  43. acl hulu_GB_users src 1.1.1.1
  44. # this should really be multiple acl statetments. large counts may overflow line buffer
  45. acl netflix_GB_users src 1.1.1.1
  46. # this should really be multiple acl statetments. large counts may overflow line buffer
  47. acl wtf_GB_users src 1.1.1.1 81.150.38.177 80.4.177.237
  48. use_backend GB_server_80 if { req.hdr(host) -i amazon.com AND amazon_GB_users }
  49. use_backend GB_server_80 if { req.hdr(host) -i amazon.com AND hulu_GB_users }
  50. use_backend GB_server_80 if { req.hdr(host) -i hulu.com AND netflix_GB_users }
  51. use_backend GB_server_80 if { req.hdr(host) -i www.wtfismyip.com AND wtf_GB_users }
  52. # this should really be multiple acl statetments. large counts may overflow line buffer
  53. acl amazon_US_users src 1.1.1.1 10.0.2.1 10.0.2.2
  54. # this should really be multiple acl statetments. large counts may overflow line buffer
  55. acl hulu_US_users src 1.1.1.1 10.0.2.1 10.0.2.2
  56. # this should really be multiple acl statetments. large counts may overflow line buffer
  57. acl netflix_US_users src 1.1.1.1 10.0.0.1 10.0.0.2
  58. # this should really be multiple acl statetments. large counts may overflow line buffer
  59. acl wtf_US_users src 1.1.1.1 81.157.241.158
  60. use_backend US_server_80 if { req.hdr(host) -i amazon.com AND amazon_US_users }
  61. use_backend US_server_80 if { req.hdr(host) -i amazon.com AND hulu_US_users }
  62. use_backend US_server_80 if { req.hdr(host) -i hulu.com AND netflix_US_users }
  63. use_backend US_server_80 if { req.hdr(host) -i www.wtfismyip.com AND wtf_US_users }
  64. backend GB_server_80
  65. server GB_server_80_0 46.101.6.173:8080 check
  66. backend US_server_80
  67. server US_server_80_0 107.170.60.217:8080 check
  68. frontend https-in
  69. bind *:8443
  70. mode tcp
  71. option tcplog
  72. log global
  73. acl permitted_ip src 10.0.0.1 10.0.0.2 81.157.241.158 80.4.177.237 81.150.38.177
  74. tcp-request inspect-delay 5s
  75. tcp-request connection reject if !permitted_ip
  76. tcp-request content accept if { req_ssl_hello_type 1 }
  77. acl amazon_GB_users src 1.1.1.1 10.0.2.3 10.0.0.1
  78. acl hulu_GB_users src 1.1.1.1
  79. acl netflix_GB_users src 1.1.1.1
  80. acl wtf_GB_users src 1.1.1.1 81.150.38.177 80.4.177.237
  81. use_backend GB_server_443 if { req_ssl_sni -i amazon.com AND amazon_GB_users }
  82. use_backend GB_server_443 if { req_ssl_sni -i amazon.com AND hulu_GB_users }
  83. use_backend GB_server_443 if { req_ssl_sni -i hulu.com AND netflix_GB_users }
  84. use_backend GB_server_443 if { req_ssl_sni -i www.wtfismyip.com AND wtf_GB_users }
  85. acl amazon_US_users src 1.1.1.1 10.0.2.1 10.0.2.2
  86. acl hulu_US_users src 1.1.1.1 10.0.2.1 10.0.2.2
  87. acl netflix_US_users src 1.1.1.1 10.0.0.1 10.0.0.2
  88. acl wtf_US_users src 1.1.1.1 81.157.241.158
  89. use_backend US_server_443 if { req_ssl_sni -i amazon.com AND amazon_US_users }
  90. use_backend US_server_443 if { req_ssl_sni -i amazon.com AND hulu_US_users }
  91. use_backend US_server_443 if { req_ssl_sni -i hulu.com AND netflix_US_users }
  92. use_backend US_server_443 if { req_ssl_sni -i www.wtfismyip.com AND wtf_US_users }
  93. backend GB_server_443
  94. log global
  95. mode tcp
  96. server GB_server_443_0 46.101.6.173:8443 check
  97. backend US_server_443
  98. log global
  99. mode tcp
  100. server US_server_443_0 107.170.60.217:8443 check
  101. listen MyStats
  102. mode http
  103. bind 0.0.0.0:1000
  104. stats enable
  105. stats uri /
  106. stats refresh 5s
  107. stats show-node
  108. stats show-legends
  109. # if authentication is wanted
  110. acl auth_ok http_auth(stats-auth)
  111. http-request auth unless auth_ok
  112. userlist stats-auth
  113. user admin insecure-password p4ss
  114. root@16049e6556cb:/etc/haproxy#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement