Moving a redirect from backend to varnish

Stig Sandbeck Mathisen ssm at
Wed Jan 17 13:08:13 CET 2007

Kenneth Rørvik <Kenneth.Rorvik at> writes:

> Kenneth Rørvik wrote:
>> Now, provided I get the right test in place - the next question is
>> how to handle the redirect itself. You could either send the request
>> on to 
> Looks like the test is OK now. Next problem: piping to the server now
> makes it impossible for the server to distinguish clients (since they
> all come from varnish), so the next Q is:
> How can I have varnish itself send a http 301 or 307 to the client
> with the correct URL? Cannot find this documented, or on google for
> that matter.

Varnish adds (or modifies an existing?) X-Forwarded-For header,
containing a path of IP addresses of the client and additional

You should be able to use the server-variable %{HTTP_FORWARDED}, or
perhaps %{HTTP_X_FORWARDED_FROM}, for matching the client address with

Note that it is possible for the user to add information to this
header when sending a request.

Stig Sandbeck Mathisen, Linpro

More information about the varnish-misc mailing list