Redirecting based on http verb and URL
Davies Matt J A (LCSS)
mjdavies at glam.ac.uk
Thu Jul 22 15:31:47 CEST 2010
Thanks Martin
Jobs a good un :-)
Matt
On 22 Jul 2010, at 07:47, Martin Boer wrote:
> 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
>> varnish-misc at varnish-cache.org
>> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
>>
>>
>>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
More information about the varnish-misc
mailing list