Welcome! Log In Create A New Profile

Advanced

Re: Content-Length header with HEAD response

May 29, 2013 08:54AM
Hi
I thought HEAD should behave as GET only in case of success
after reading the RFC I understand it's should be the same on any response
Thanks


On Wed, May 29, 2013 at 3:10 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Wed, May 29, 2013 at 02:49:46PM +0300, Hagai Avrahami wrote:
>
> > Hi
> >
> > I am trying to configure Nginx to deny HTTP HEAD requests
> >
> > 1. By adding the following to configuration file
> >
> > if ($request_method !~ ^(GET)$) {
> > return 405;
> > }
> >
> > 2. Explicitly in the module
> >
> > if (!(r->method & (NGX_HTTP_GET))) {
> > return NGX_HTTP_NOT_ALLOWED;
> > }
> >
> > Nginx returns 405 status code but the response content length is not 0
> > it's counting the error page text but when coming to send the response it
> > ignores the body because it is HEAD request
> >
> > HTTP/1.1 405 Not Allowed
> > Server: nginx
> > Date: Wed, 29 May 2013 11:35:02 GMT
> > Content-Type: text/html
> > Content-Length: 161
> > Connection: keep-alive
> >
> > ***No-Body**
>
> And the question is? The behaviour you observe is correct as per
> HTTP protocol.
>
> --
> Maxim Dounin
> http://nginx.org/en/donation.html
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



--

*Hagai Avrahami*
Qwilt | Work: +972-72-2221644| Mobile: +972-54-4895656 |
hagaia@qwilt.com<yoav@qwilt.com>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Content-Length header with HEAD response

hagaizzz May 29, 2013 07:52AM

Re: Content-Length header with HEAD response

Maxim Dounin May 29, 2013 08:12AM

Re: Content-Length header with HEAD response

hagaizzz May 29, 2013 08:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 275
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready