Forum: NGINX Should it be "if ( $request_method !~ ^(GET.)" or "limit_except GET." ?

Posted by Mark Alan (Guest)
on 2013-01-23 12:57
(Received via mailing list)
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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.