<div><br><div class="gmail_quote">On Tue, Feb 22, 2011 at 5:31 PM, Traian Bratucu <span dir="ltr"><<a href="mailto:traian.bratucu@eea.europa.eu">traian.bratucu@eea.europa.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Just a note: please be aware that by default PHP will issue some headers that will not permit caching (Cache-Control). Please also verify php.ini.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Regarding your regex... you wrote “phg”...</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Traian</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> <a href="mailto:varnish-misc-bounces@varnish-cache.org" target="_blank">varnish-misc-bounces@varnish-cache.org</a> [mailto:<a href="mailto:varnish-misc-bounces@varnish-cache.org" target="_blank">varnish-misc-bounces@varnish-cache.org</a>] <b>On Behalf Of </b>Shibashish<br>
<b>Sent:</b> Tuesday, February 22, 2011 12:57 PM<br><b>To:</b> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br><b>Subject:</b> Force cache a php page</span></p><div><div>
</div><div class="h5"><p class="MsoNormal"> </p><div><p class="MsoNormal">Hi All,</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">I have a website under varnish-2.1.5-1. I have a php page (test.php) which is kinda static and I can cache it for some time (5 mins). The URLs hitting this page are like the following due to which the varnish cache is MISSed and the apache webserver is being hit. How do I do a regex to overcome this? My trial config is mentioned in the end....</p>
</div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=219488&TabID=3&Res=2&dt=866845858823555200</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=253114&TabID=3&Res=2&dt=846642321042837100</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=104326&TabID=3&Res=2&dt=575570316149238400</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=30946&TabID=3&Res=2&dt=109061349055833870</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=109331&TabID=3&Res=2&dt=284968385895093150</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=147630&TabID=3&Res=2&dt=182582005324904030</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=226618&TabID=3&Res=2&dt=567666382104328500</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=44438&TabID=3&Res=2&dt=894643067109792400</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=219029&TabID=3&Res=2&dt=120583019713746690</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=92700&TabID=3&Res=2&dt=812672457300415500</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=244364&TabID=3&Res=2&dt=543154670573941800</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=204543&TabID=3&Res=2&dt=108553982023531000</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=155579&TabID=3&Res=2&dt=609157805933082500</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=100248&TabID=3&Res=2&dt=329215175928002100</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=155347&TabID=3&Res=2&dt=324280933690657500</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=153167&TabID=3&Res=2&dt=262366359106033180</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=175035&TabID=3&Res=2&dt=748310387497392400</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=122942&TabID=3&Res=2&dt=89373125154077630</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=157531&TabID=3&Res=2&dt=164945409132294180</p></div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=100248&TabID=3&Res=2&dt=381019014643790400</p>
</div><div><p class="MsoNormal"> 1.00 TxURL /test.php?id=103053&TabID=3&Res=2&dt=597790616600820500</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">
vcl_recv</p></div><div><p class="MsoNormal"> </p></div><div><div><p class="MsoNormal"> if (req.url ~ "\.phg(\?.*)?$") {</p></div><div><p class="MsoNormal"> return(lookup);}</p></div></div><div><p class="MsoNormal">
</p></div><div><p class="MsoNormal">Thanks.</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">--</p></div><div><p class="MsoNormal">Shib</p></div></div></div></div></div></blockquote></div><br></div>
<div>Thanks for your reply. The header has....<div><br></div><div>Cache-Control<span class="Apple-tab-span" style="white-space: pre; "> </span>max-age=600, public</div><div><br></div><div>The regex has been corrected. Just to let you know that any subsequent requests to the same url, i.e. /test.php?abc, if hit for a second or 3rd time or more, shows a cache HIT.</div>
<div><br clear="all">ShiB.<br>while ( ! ( succeed = try() ) );</div></div>