Name
HTTPRedirectToName
Synopsis
HTTPRedirectToName [format string] Default [ServerName for the chosen Apache server] Directory
Like HTTPRedirectToIP
, this tells
mod_backhand
to redirect instead of proxying.
However, in this case it redirects to a DNS name constructed from the
ServerName
and the contents of the
Host:
header in the request. By default, it is the
ServerName
, but for complex setups hosting
multiple servers on the same server farm, more cunning may be
required to end up at the right virtual host on the right machine.
So, the format string can be used to control the construction of the
DNS name to which you’re redirected. We can do no
better than to reproduce
mod_backhand
’s documentation:
The format string is just like C format string except that it only has two insertion tokens:
%#S
and%#H
(where#
is a number).
%-#S
is the server name with the right#
parts chopped off. If your server name iswww-1.jersey.domain.com
,%-3S
will yieldwww-1
.
%#S
is the server name with only the#
left parts preserved. If your server name iswww-1.jersey.domain.com
,%2S
will yieldwww-1.jersey
.
%-#H
is theHost:
with only the right # parts preserved. If theHost:
iswww.client.com
,%-2S
will yieldclient.com
.
%#H
will be theHost:
with the left#
parts chopped off. If theHost:
iswww.client.com
,%1H
will yieldclient.com
.For example, if you run a hosting company
hosting.com
and you have 5 machines namedwww[1-5].sanfran.hosting.com
. You hostwww.client1.com
andwww.client2.com
Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.