Forum: NGINX Should we use "if ( $request_method." or "limit_except." ?

Posted by Mark Alan (Guest)
on 2012-09-28 13:05
(Received via mailing list)
Hello list,


Can anybody tell me if the bellow constructs are equivalent?

server {
  ...
  if ( $request_method !~ ^(?:GET|HEAD|POST)$ ) { return 444; }
  ...

server {
  ...
  location / {
    limit_except GET HEAD POST { deny  all; }
  ...

And, if they are equivalent, in the case of having multiple locations,
is it still better to have a limit_except for each location? Or, in
this case is it better to have a single "if ( $request_method ..."  at
server level ?

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.