Forcing backend http requests to go thru varnish

Payton, Karen J PaytonK at email.chop.edu
Tue Oct 8 19:05:02 CEST 2013


Hi all,

I have some js in a site on my backend that does a jQuery get on an ajax page within the same site (so in theory all the work takes place in the same webserver).
The code looks something like this:

jQuery.get('/ajax?reqtype=providersearch&location='+mylocation+'&maxdistance='+maxdistance+'&cat=,'+mycat);

Of course I'd like to repopulate the Varnish cache for a long list of zip codes, so I set up a wget that would hit this ajax page for any number of location variables.
The only problem is that from within the site, it doesn't know about Varnish and doesn't go thru Varnish as the front end… so my prepopulated cache is worthless when my page hits that same ajax from within a web session.  At least I think that's what's going on.

I thought that forcing a fully qualified url might cause the jQuery.get to go outside the server and come thru the Varnish front door, so I coded this:

jQuery.get('http://[my.website.address.com]/programs/roadmap/ajax/?reqtype=providersearch&location='+mylocation+'&maxdistance='+maxdistance+'&cat=,'+mycat);

Still no dice.  Anyone have experience getting an ajaxed chunk of data cached effectively using Varnish?

Thanks for your help, I'm new so if this is obvious please forgive my ignorance!

Joy Payton
Web Services
X 67658

great service --> great discoveries
Have I provided you with great service that powers your great discoveries?  Tell me about it.<http://www.surveymonkey.com/s/TXW3MM9>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20131008/122106ba/attachment.html>


More information about the varnish-misc mailing list