Skip to content

Instantly share code, notes, and snippets.

@terrancesnyder
Created May 29, 2011 18:52
Show Gist options
  • Save terrancesnyder/998039 to your computer and use it in GitHub Desktop.
Save terrancesnyder/998039 to your computer and use it in GitHub Desktop.
haproxy.cfg - Example HAProxy Configuration
# /etc/haproxy.cfg
global
user haproxy
group haproxy
defaults
mode http
option forwardfor
option redispatch
retries 3
maxconn 2000
contimeout 5000
clitimeout 30000
srvtimeout 30000
# solr backend
backend solr
reqirep ^GET\ /(.*) GET\ /apache-solr-3.1.0/\1
balance roundrobin
option redispatch
option httpclose
cookie SERVERID insert nocache indirect
server <myserver> <myserver>:8080 cookie <myserver> check
stats uri /haproxy
stats realm haproxy
stats auth tomcat:tomcat
stats scope .
# default backend
backend default
balance roundrobin
option redispatch
option httpclose
cookie SERVERID insert nocache indirect
server <myserver> <myserver>:8080 cookie <myserver> check
stats uri /haproxy
stats realm haproxy
stats auth tomcat:tomcat
stats scope .
frontend default
bind *:80
acl search.contoso.com hdr_end(host) -i search.contoso.com
acl builds.contoso.com hdr_end(host) -i builds.contoso.com
acl selenium.contoso.com hdr_end(host) -i selenium.contoso.com
acl _jenkins url_sub jenkins
acl _sonar url_sub sonar
acl _artifactory url_sub artifactory
use_backend jenkins if builds.contoso.com _jenkins
use_backend sonar if builds.contoso.com _sonar
use_backend artifactory if builds.contoso.com _artifactory
use_backend solr if search.contoso.com
use_backend seleniumgrid if selenium.contoso.com
default_backend default
@terrancesnyder
Copy link
Author

/etc/haproxy/haproxy.cfg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment