Via header

Igor Sysoev is at
Fri Jan 26 15:17:53 MSK 2007

On Fri, 26 Jan 2007, Ian Evans wrote:

> Using nginx to reverse proxy dynamic calls to Apache.
> Been having a problem with the phpAdsNew software not always logging the
> real IP, which therefore affects geotargetting. Some IPs are being logged
> properly (nginx is sending the HTTP_X_FORWARDED_FOR and HTTP_X_REAL_IP
> headers) but many are being logged as
> I spoke to the phpAdsNew developers and they said:
> "Since Openads proxy lookup feature wasn't created to deal with reverse
> proxies it expects either a "Via" header (HTTP_VIA) or a reloved host
> containing "cache", "proxy" or "inktomi"."
> They asked me if I could ad the Via: header to the proxy. They said:
> "So, the headers should look like:
> GET ....
> ...
> Via: 1.1 your-proxy
> X-Forwarded-For: your-real-ip
>> From RFC 2068:
> 14.44 Via
> The Via general-header field MUST be used by gateways and proxies to
> indicate the intermediate protocols and recipients between the user
> agent and the server on requests, and between the origin server and
> the client on responses. It is analogous to the "Received" field of
> RFC 822 and is intended to be used for tracking message forwards,
> avoiding request loops, and identifying the protocol capabilities of
> all senders along the request/response chain."
> So, is there anything I can do to add the Via header through nginx?

nginx currently has no $proxy_add_via variable similar to
$proxy_add_x_forwarded_for, that would allow set Via using simple

     proxy_set_header  Via  $proxy_add_via;

However, you may use the following configuration:

     location / {

         set  $via  "1.0";
         if ($http_via) {
             set $via  "$http_via, 1.0";


         proxy_set_header  Via  $via;

Igor Sysoev

More information about the nginx mailing list