pass user IP to file

Andy Bailey andrewgbailey at
Tue Nov 30 14:01:33 CET 2010

thanks for your help. This is just for one file that is accessed by all and
it doesn't matter if the user is logged in or not.
if have tried

if (req.url ~ "commentluvapi.php") {



but requests made to that file show headers that tell me it was cached, I
made sure I did a /etc/init.d/varnish restart after changing default.vcl .Is
there anything else I should do to make sure varnish reloads the config?

I have just had mod_extract_forwarded added to apache so I will be adding set
req.http.X-Forwarded-For = client.ip; also, will this help?

thanks so much for your replies


Download the CommentLuv plugin for Wordpress and reward your readers.

On Tue, Nov 30, 2010 at 12:52 PM, Bob Camp <lists at> wrote:

> Hi
> Is it a single file, or does each user get their own file (just curious) ?
> One way or the other you will need to be sure that the file request is
> passed to the backend and that the results are always honored. These setups
> can be a big pain with a cache, since the cache does not know much about who
> is and who is not logged in. It will server stuff when it's not supposed to.
> It can block (as you have seen) the keep alive. If this is for occasional
> use, you might consider a separate path to the backend for this stuff that
> goes around the cache. I do it by looking at the requested URL's and
> deciding that it's a "don't bother with the cache" sort of request.
> Bob
> On Nov 29, 2010, at 4:48 PM, Andy Bailey wrote:
> > I have a file on my server that checks a user hasn't accessed it more
> than 5 times in the past 5 minutes by saving the IP address of every
> request. Since having varnish installed, the file is denying access to
> everyone because for some reason the IP address that is being stored is
> always my server IP. How would I make sure that requests to that file pass
> the users IP address?
> >
> > hope you can help?
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list