I'd use ~ instead of == in the first if statement. If doubt 'equal' will
fit a regular expression where 'looks something like' will.
And perhaps 'website' instead of 'webiste', but that may have come from
you disguising the url.
Hope either one of them helps. :)
Martin
On 07/21/2010 02:13 PM, Davies Matt J A (LCSS) wrote:
Hello everyone
I'm just checking I'm going down the right path here.
I've read the example redirect section on the docs here,
http://varnish-cache.org/wiki/VCLExampleRedirectInVCL
In my case we've just moved web sites, and some crazy dudes are spamming our
site, trying to send a POST form to an one page that may have one time allowed
it.
My Rails app is picking up these attempts at spam and throwing them out, but I
want to handle them, and other normal people who simply click on the old link
somewhere, with varnish prior to that.
Here's my addition to the vcl_recv
if (req.http.host == "^(www.)?webiste/blogs/oldpage$") {
error 750 "Moved Temporarily";
if (req.request == "POST"){
error 751 "Please go away"
}
}
and vcl_error
sub vcl_error {
if (obj.status == 750) {
set obj.http.Location = "http://newblogs";
set obj.status = 302;
deliver;
}
if (obj.status == 751) {
set obj.status = 500;
deliver;
}
}
Can anyone see any glaringly obvious stupid bits in there?
Thanks again.
_______________________________________________
varnish-misc mailing list
[email protected]
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
_______________________________________________
varnish-misc mailing list
[email protected]
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc