Skip to main content

haproxy: redirect to ssl or other website

09-12-2013 | 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.

This snippet is tested on a Digital Ocean VPS. If you like this snippet and want to support me, plus get free credit @ DO, use this link to order a Digital Ocean VPS:

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

frontend example-frontend
  redirect location

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

More info:

Tags: apache  haproxy  loadbalancer  redirect  snippets  ssl