<span style='font-family:Verdana'><span style='font-size:12px'>Hello,<br />
<br />
I managed to add an new header:<br />
<br />
x-url: /topic/123-my-topic/<br />
<br />
So I just need to add this bit?<br />
<br />
sub vcl_fetch {<br />
if (req.request == "POST" && beresp.http.x-url) {<br />
purge("obj.http.host == example.com && req.url ~ " beresp.http.x-url);<br />
}<br />
}<br />
<br />
Note that I need to purge /topic/123-my-topic/ and /topic/123-my-topic/all pages after slash.<br />
In this case can I use purge("obj.http.host == example.com && req.url ~ " beresp.http.x-url.*$);?<br />
<br />
Thanks<br />
<br />
<p style="margin:0px; padding:0px;" >
</p>
<blockquote style="border-left: 1px solid #CCC; padding-left: 5px; margin-left: 5px; margin-bottom: 0px; margin-top: 0px; margin-right: 0px;" type="cite">
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">----- Original Message -----</span></span></p>
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">From: Rob S</span></span></p>
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">Sent: 07/06/11 11:25 AM</span></span></p>
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">To: varnish-misc@varnish-cache.org</span></span></p>
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">Subject: Re: Purging on form submit</span></span></p>
<br />
<div bgcolor="#ffffff" text="#000000">
On 06/07/2011 10:26, Nuno Neves wrote:
<blockquote type="cite">
<span style="font-family: Verdana;"><span style="font-size: 12px;">how can I get the hiden input value I have that tell varnish that we have a new post? <br />
<br />
<span class="webkit-html-tag"><input <span class="webkit-html-attribute-name">type</span>="<span class="webkit-html-attribute-value">hidden</span>" <span class="webkit-html-attribute-name">name</span>="canpurge" <span class="webkit-html-attribute-name">value</span>="/topic/123-my-topic/" /></span> <br />
<br />
I was thinking of something like this:</span></span><br />
<br />
<div>
<span style="font-family: Verdana;"><span style="font-size: 12px;">sub vcl_recv {</span></span></div>
<div>
<span style="font-family: Verdana;"><span style="font-size: 12px;"> if (req.request == "POST" && FORM.FIELD == "canpurge) {</span></span></div>
<div>
<span style="font-family: Verdana;"><span style="font-size: 12px;"> purge req.http.host == example.com && req.url ~ ^FORM.CANPURGE.VALUE.*$</span></span></div>
<div>
<span style="font-family: Verdana;"><span style="font-size: 12px;"> }</span></span></div>
<div>
<span style="font-family: Verdana;"><span style="font-size: 12px;">}</span></span></div>
</blockquote>
<br />
Nuno:<br />
<br />
Varnish can't see the body of the response. However, if you're able to change the response, you can just add an HTTP header with this information. Then, in vcl_fetch (which is where the HTTP request is sent to the backend), you can probably add something like:<br />
<br />
sub vcl_fetch {<br />
if (beresp.http.x-purgepattern) {<br />
purge("obj.http.host == example.com && req.url ~ " beresp.http.x-purgepattern);<br />
}<br />
}<br />
<br />
<br />
Rob</div>
</blockquote>
<p style="margin:0px; padding:0px;" >
</p>
</span></span>