# Should it be "if ( $request\_method !~ ^(GET.)" or "limit\_except GET."?

**URL:** <https://www.ruby-forum.com/t/should-it-be-if-request-method-get-or-limit-except-get/225684>\
**Category:** NGINX\
**Created:** [January 23, 2013, 12:57pm UTC](https://www.ruby-forum.com/t/should-it-be-if-request-method-get-or-limit-except-get/225684 "2013-01-23T12:57:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [January 23, 2013, 12:57pm UTC](https://www.ruby-forum.com/t/should-it-be-if-request-method-get-or-limit-except-get/225684/1 "2013-01-23T12:57:23Z")

</div>

Hello,

Can anybody tell me if the bellow constructs are equivalent?

In case of a dozen or so ‘location’, would it still be better to have a  
limit\_except for each location or, in that case, would it be better to  
have a server level single ‘if ( $request\_method…’ ?

server {  
…  
if ( $request\_method !~ ^(?:GET|HEAD|POST)$ ) { return 444; }  
…

server {  
…  
location / {  
limit\_except GET HEAD POST { deny all; }  
…

Thank you,  
Mark
