<div dir="ltr"><div>Hi<br><br></div><div>I am trying to configure Nginx to deny HTTP HEAD requests <br><br>1. By adding the following to configuration file<br><br></div><div>if ($request_method !~ ^(GET)$) {<br></div><div>

    return 405;<br>}<br></div><div><br></div><div>2. Explicitly in the module <br><br>if (!(r->method & (NGX_HTTP_GET))) {<br>        return NGX_HTTP_NOT_ALLOWED;<br> }<br><br></div><div>Nginx returns 405 status code but the response content length is not 0<br>

</div><div>it's counting the error page text but when coming to send the response it <br>ignores the body because it is HEAD request<br><br>HTTP/1.1 405 Not Allowed<br>Server: nginx<br>Date: Wed, 29 May 2013 11:35:02 GMT<br>

Content-Type: text/html<br>Content-Length: 161<br>Connection: keep-alive<br><br></div><div>***No-Body**<br><br><br></div><div>Please Advise<br></div><div>Thanks<br></div><div>Hagai Avrahami<br></div></div>