FWIW, in my limited testing, the limit_except method was ~15% faster than this approach.<br><br>>j.<br><br><div class="gmail_quote">On Tue, May 13, 2008 at 6:05 PM, Calomel <<a href="mailto:nginxlist@calomel.org">nginxlist@calomel.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You can also use regular expressions for a bit more flexibility. This<br>
way you can explicitly accept only the request methods you allow and<br>
return the error code of your choosing.<br>
<br>
## Only allow GET and HEAD request methods<br>
if ($request_method !~ ^(GET|HEAD)$ ) {<br>
return 444;<br>
}<br>
<br>
Nginx "How to" Fast and Secure webserver<br>
<a href="https://calomel.org/nginx.html" target="_blank">https://calomel.org/nginx.html</a><br>
<br>
--<br>
Calomel @ <a href="https://calomel.org" target="_blank">https://calomel.org</a><br>
Open Source Research and Reference<br>
<br>
<br>
On Wed, May 14, 2008 at 12:44:22AM +0200, Rafa?? Zawadzki wrote:<br>
>Tuesday 13 May 2008 23:26:40 Rt Ibmer napisa??(a):<br>
<div class="Ih2E3d">>> My nginx server should never receive POST requests of any time (only HEAD<br>
>> and GET). How can I set up the configuration so that it will return<br>
>> forbidden (or otherwise just drop the request completely) if someone tries<br>
>> to POST data to my server? I thought I saw this somewhere a while back, but<br>
>> just checked the docs and mailing list archive and can't locate the info.<br>
>> Thanks!<br>
><br>
>Try:<br>
><br>
>limit_except GET HEAD {<br>
> deny all;<br>
>}<br>
><br>
>and give any feedback.<br>
><br>
>P.S.<br>
><br>
><a href="http://wiki.codemongers.com/NginxHttpCoreModule#limit_except" target="_blank">http://wiki.codemongers.com/NginxHttpCoreModule#limit_except</a><br>
><br>
>Cheers,<br>
><br>
>--<br>
</div>>Rafa?? Zawadzki [ System Architect ]<br>
<div><div></div><div class="Wj3C7c">> RHCE Red Hat Certified Engineer<br>
>tel +48 22 8430101<br>
>mobile +48 600 883 759<br>
>skype id blvszcz<br>
>jabber id <a href="mailto:bluszcz@gmail.com">bluszcz@gmail.com</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br>