We are building a site which needs to be cached, but we need to have a tracking image that gets output for every page. This image should contain certain (lets say all) parameters of the query string. <br><br>I'm thinking of implementing this using ESI. I currently have the following:<br>
<br>test.php<br> <esi:include src="/esi/<a href="http://tracker.pl">tracker.pl</a>"/><br><br>/esi/<a href="http://tracker.pl">tracker.pl</a><br>#!/usr/bin/perl<br>use CGI::Cookie ();<br>use Apache2::RequestRec ();<br>
use APR::Table ();<br>my $cookie = CGI::Cookie->new(-name => 'mod_perl',<br> -value => 'awesome');<br>print "Set-Cookie: $cookie\n";<br>print "Content-type: text/html\n\n";<br>
print <<ENDHTML;<br>$ENV{'QUERY_STRING'}<br><div><br><img src="<a href="http://sometrackingsite/id/12345.gif?url=ENTER+PAGE+URL+HERE&title=ENTER+PAGE+TITLE+HERE">http://sometrackingsite/id/12345.gif?url=ENTER+PAGE+URL+HERE&title=ENTER+PAGE+TITLE+HERE</a>" alt="" height="1" width="1" /><br>
</div><br>ENDHTML<br><br>default.vcl<br>...<br>sub vcl_fetch {<br> set beresp.ttl=5d;<br> if (req.url ~"test.php") {<br> esi; /* Do ESI processing */<br> set beresp.ttl = 24 h;<br> } elseif (req.url == "/esi/<a href="http://tracker.pl">tracker.pl</a>") {<br>
set beresp.ttl = 1m;<br> }<br> if (beresp.http.set-cookie) {<br> set beresp.http.set-cookie = ";" beresp.http.set-cookie;<br> set beresp.http.set-cookie = regsuball(beresp.http.set-cookie, "; +", ";");<br>
set beresp.http.set-cookie = regsuball(beresp.http.set-cookie, ";(MY_COOKIE)=", "; \1=");<br> set beresp.http.set-cookie = regsuball(beresp.http.set-cookie, ";[^ ][^;]*", "");<br>
set beresp.http.set-cookie = regsuball(beresp.http.set-cookie, "^[; ]+|[; ]+$", "");<br><br> if (beresp.http.set-cookie == "") {<br> remove beresp.http.set-cookie;<br> }<br> return (deliver);<br>
}<br>}<br>...<br><br>Am I going about this the right way? Perl doesn't seem to see the query string or be able to set any cookies. <br><br>Any help would be appreciated. <br><br>Russ<br><div style="visibility: hidden; left: -5000px;" id="avg_ls_inline_popup">
</div><style type="text/css">#avg_ls_inline_popup{position: absolute;z-index: 9999;padding: 0px 0px;margin-left: 0px;margin-top: 0px;overflow: hidden;word-wrap: break-word;color: black;font-size: 10px;text-align: left;line-height: 130%;}</style>