FWIW, in my limited testing, the limit_except method was ~15% faster than this approach.<br><br>&gt;j.<br><br><div class="gmail_quote">On Tue, May 13, 2008 at 6:05 PM, Calomel &lt;<a href="mailto:nginxlist@calomel.org">nginxlist@calomel.org</a>&gt; 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>
 &nbsp; &nbsp; &nbsp;if ($request_method !~ ^(GET|HEAD)$ ) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; return 444;<br>
 &nbsp; &nbsp; &nbsp;}<br>
<br>
 &nbsp;Nginx &quot;How to&quot; Fast and Secure webserver<br>
 &nbsp;<a href="https://calomel.org/nginx.html" target="_blank">https://calomel.org/nginx.html</a><br>
<br>
--<br>
 &nbsp;Calomel @ <a href="https://calomel.org" target="_blank">https://calomel.org</a><br>
 &nbsp;Open Source Research and Reference<br>
<br>
<br>
On Wed, May 14, 2008 at 12:44:22AM +0200, Rafa?? Zawadzki wrote:<br>
&gt;Tuesday 13 May 2008 23:26:40 Rt Ibmer napisa??(a):<br>
<div class="Ih2E3d">&gt;&gt; My nginx server should never receive POST requests of any time (only HEAD<br>
&gt;&gt; and GET). How can I set up the configuration so that it will return<br>
&gt;&gt; forbidden (or otherwise just drop the request completely) if someone tries<br>
&gt;&gt; to POST data to my server? I thought I saw this somewhere a while back, but<br>
&gt;&gt; just checked the docs and mailing list archive and can&#39;t locate the info.<br>
&gt;&gt; Thanks!<br>
&gt;<br>
&gt;Try:<br>
&gt;<br>
&gt;limit_except &nbsp;GET HEAD {<br>
&gt; &nbsp; &nbsp;deny &nbsp; all;<br>
&gt;}<br>
&gt;<br>
&gt;and give any feedback.<br>
&gt;<br>
&gt;P.S.<br>
&gt;<br>
&gt;<a href="http://wiki.codemongers.com/NginxHttpCoreModule#limit_except" target="_blank">http://wiki.codemongers.com/NginxHttpCoreModule#limit_except</a><br>
&gt;<br>
&gt;Cheers,<br>
&gt;<br>
&gt;--<br>
</div>&gt;Rafa?? Zawadzki [ System Architect ]<br>
<div><div></div><div class="Wj3C7c">&gt; &nbsp;RHCE Red Hat Certified Engineer<br>
&gt;tel &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+48 22 8430101<br>
&gt;mobile &nbsp; &nbsp; &nbsp; &nbsp; +48 600 883 759<br>
&gt;skype id &nbsp; &nbsp; &nbsp; blvszcz<br>
&gt;jabber id &nbsp; &nbsp; &nbsp;<a href="mailto:bluszcz@gmail.com">bluszcz@gmail.com</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br>