From 3fd48ee8b17ba92d9365049cd983c69702269d2c Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 23 Sep 2006 19:30:29 +0000 Subject: [PATCH] Always send X-Forwarded-for: header to backend. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1121 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_fetch.c | 2 ++ varnish-cache/bin/varnishd/cache_pass.c | 2 ++ varnish-cache/bin/varnishd/cache_pipe.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index d1889455..1a96b31a 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -341,6 +341,8 @@ FetchHeaders(struct sess *sp) http_GetReq(w, vc->fd, vc->http, sp->http); http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_FETCH); http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid); + http_PrintfHeader(w, vc->fd, vc->http, + "X-Forwarded-for: %s", sp->addr); if (!http_GetHdr(vc->http, H_Host, &b)) { http_PrintfHeader(w, vc->fd, vc->http, "Host: %s", sp->backend->hostname); diff --git a/varnish-cache/bin/varnishd/cache_pass.c b/varnish-cache/bin/varnishd/cache_pass.c index 86ec8d63..d78c7681 100644 --- a/varnish-cache/bin/varnishd/cache_pass.c +++ b/varnish-cache/bin/varnishd/cache_pass.c @@ -187,6 +187,8 @@ PassBody(struct sess *sp) http_CopyResp(sp->wrk, sp->fd, sp->http, vc->http); http_FilterHeader(sp->wrk, sp->fd, sp->http, vc->http, HTTPH_A_PASS); http_PrintfHeader(sp->wrk, sp->fd, sp->http, "X-Varnish: %u", sp->xid); + http_PrintfHeader(sp->wrk, sp->fd, sp->http, + "X-Forwarded-for: %s", sp->addr); /* XXX */ if (http_HdrIs(vc->http, H_Transfer_Encoding, "chunked")) http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Transfer-Encoding: chunked"); diff --git a/varnish-cache/bin/varnishd/cache_pipe.c b/varnish-cache/bin/varnishd/cache_pipe.c index c2cf1116..877c9171 100644 --- a/varnish-cache/bin/varnishd/cache_pipe.c +++ b/varnish-cache/bin/varnishd/cache_pipe.c @@ -88,6 +88,8 @@ PipeSession(struct sess *sp) http_CopyReq(w, vc->fd, vc->http, sp->http); http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_PIPE); http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid); + http_PrintfHeader(w, vc->fd, vc->http, + "X-Forwarded-for: %s", sp->addr); WRK_Reset(w, &vc->fd); http_Write(w, vc->http, 0); -- 2.39.5