ALOHA load balancer Redirecting a domain

Target network diagram

Functions to use for ALOHA 5.5.4 and above

Despite the « redirect location » and « redirect prefix » functions are also available in the ALOHA 5.5.4 and above, it is recommended to use their equivalent through « http-request » for an easy reading of the configuration. Parameters are strictly the same for both ways.

http-request redirect location <to> [code <code>] <option> [{if | unless} <condition>]
http-request redirect prefix <to> [code <code>] <option> [{if | unless} <condition>]

Functions to use for ALOHA 3.x until 5.5.3

Redirect location <to> [code <code>] <option> [{if | unless} <condition>]
Redirect prefix <to> [code <code>] <option> [{if | unless} <condition>]


Return an HTTP redirection if a condition is met. If no condition is specified, the redirection is applied directly.


<to> this value is placed in the “Location” field of the HTTP header. In the event of a redirection with a prefix, the “Location” field of the HTTP header is created by concatenating “to” and the complete URL, including the query string, unless the “drop-query” option is specified.

<code> The code is optional. It indicates which HTTP redirection type is required. Only codes 301, 302 and 303 are managed. Code 302 is used if no other code is specified.

<option> You can specify several options in order to adapt the expected behavior of a redirection:


When this option is used with a redirection based on the prefix, the location will be set without any additional query string.


Use this option in conjunction with drop-query in order to redirect users who specify a URL which does not end with “/”. This may be useful for ensuring search engines see only one URL.

set-cookie NAME [=value]

A “set-cookie” header will be added to the response with a name (and “= value” as required). This method is used occasionally to specify that a user has been seen. If no additional options are added, then the cookie will be a session cookie.

clear-cookie NAME [=]

A “set-cookie” header will be added with a name (and “=” as required), but with “MaxAge” set to zero. This option tells the browser to delete this cookie.

Extract of the LB Level7 configuration

######## The first public address as seen by the clients
frontend frt
 bind # address:port to listen to
 mode http
 log global # use global log parameters
 option httplog # Enable HTTP logging
 # Detect the host name in the “ ” header
 acl detect hr(host) -i
 # Redirect "" to ""
 # Until ALOHA 5.5.3
 redirect prefix if detect
 # ALOHA 5.5.4 and above
 http-request redirect prefix if detect
 maxconn 4000 # max conn per instance
 timeout client 25s # maximum client idle time (ms)
 default_backend bck # send everything to this backend by default

####### This backend manages the servers and the load balancing algorithm
backend bck
 balance roundrobin # roundrobin | source | uri | leastconn
 mode http
 log global # use global log parameters
 option httplog # Enable HTTP logging
 cookie SERVERID insert indirect nocache # provide persistence with cookie
 option httpchk HEAD / # how to check those servers
 option forwardfor except # add X-Forwarded-For except local
 fullconn 4000 # dynamic limiting below
 timeout server 25s # max server’s response time (ms)
 server srv1 cookie s1 weight 10 maxconn 100 check inter 1000 fall 3
 server srv2 cookie s2 weight 10 maxconn 100 check inter 1000 fall 3

Related services - Writing condition rules

To know how to create rules which allow (or not) the redirection, please read the application note #0057 – HTTP Request Routing.

Redirecting a domain

This application note is intended to help you implement a domain redirection from one specific site to another using the ALOHA Load Balancer solution.


Replace the “” domain with “”




v3.x and later