atom feed16 messages in ru.sysoev.nginxRe: How to block POST requests?
FromSent OnAttachments
Rt IbmerMay 13, 2008 2:26 pm 
Rafał ZawadzkiMay 13, 2008 3:43 pm 
CalomelMay 13, 2008 6:04 pm 
Rt IbmerMay 13, 2008 8:44 pm 
Jay ReitzMay 13, 2008 9:45 pm 
Igor SysoevMay 14, 2008 2:53 am 
Rt IbmerMay 19, 2008 7:50 pm 
CalomelMay 20, 2008 10:02 am 
Rt IbmerMay 20, 2008 11:47 am 
Rt IbmerMay 20, 2008 8:02 pm 
CalomelMay 21, 2008 9:33 am 
Jonathan VanascoJul 24, 2009 11:52 am 
peacockJul 28, 2009 8:49 pm 
Igor SysoevJul 29, 2009 1:32 am.Other
peacockJul 29, 2009 5:24 am 
peacockJul 29, 2009 5:24 am 
Subject:Re: How to block POST requests?
From:Rt Ibmer (rtib@public.gmane.org)
Date:May 19, 2008 7:50:17 pm
List:ru.sysoev.nginx

You can also use regular expressions for a bit more flexibility. This way you can explicitly accept only the request methods you allow and return the error code of your choosing.

## Only allow GET and HEAD request methods if ($request_method !~ ^(GET|HEAD)$ ) { return 444; }

Hello - I am using the latest nginx 6. When I try to do as you say above I am
getting the error in the nginx error file: unknown directive "if" in xyz.log

I am using your exact block as above and from your web page, like this:

if ($request_method !~ ^(GET|HEAD)$ ) { return 444; }

I have tried this within the main server directive as well as from within
location directives, but always get this error. Obviously I am missing
something? Thanks.