Skip to main content

Raymii.org Logo (IEC resistor symbol) logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher

haproxy: redirect to ssl or other website

Published: 09-12-2013 | Author: Remy van Elst | Text only version of this article


Table of Contents


This snippet shows you how to use haproxy to redirect http traffic to https or any other website.

This snippet was tested on haproxy 1.5.

If you like this article, consider sponsoring me by trying out a Digital Ocean VPS. With this link you'll get $100 credit for 60 days). (referral link)

To redirect traffic from a haproxy frontend, use the following config:

frontend example-frontend
  bind 10.20.30.40:80
  redirect location https://example.org:443

As you can see, the redirect location can be anything, for example, the ssl version of the frontend or any other website.

More info: http://cbonte.github.io/haproxy- dconv/configuration-1.5.html#redirect

Tags: apache , haproxy , loadbalancer , redirect , snippets , ssl