Parsnips.net Like a Carrot

27Nov/110

haproxy http to https redirect

For those who are lazy, and don't want to understand haproxy thaaat well. In order to redirect all traffic from http to https use a variation of the following in your haproxy.cfg

#---------------------------------------------------------------------
# Redirect to secured
#---------------------------------------------------------------------
frontend unsecured *:80
    redirect location https://foo.bar.com

#---------------------------------------------------------------------
# frontend secured
#---------------------------------------------------------------------
frontend  secured *:443
   mode  tcp 
   default_backend		app

#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend app
    mode  tcp
    balance roundrobin
    server  app1 127.0.0.1:5001 check
    server  app2 127.0.0.1:5002 check
    server  app3 127.0.0.1:5003 check
    server  app4 127.0.0.1:5004 check
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.