rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: gork on October 09, 2014, 08:51:26 PM

Title: Bug (2.3d): HTTP responses are not standards compliant
Post by: gork on October 09, 2014, 08:51:26 PM
Hello,

I have discovered when putting HFS behind a proxy that many of its HTTP responses are not standards compliant. HFS is unusable behind such a system.

HTTP 1.1 requires a header which will allow the client to determine the end of the response. In error pages and during redirects, HFS lacks this header. Some proxies give 502 BAD_GATEWAY errors when this occurs.

This header may be one of:

Content-Length: <valid # of bytes, can be 0>

Transfer-Encoding: chunked

Connection: close

This last option is what HFS is usually doing when it sends error or redirect pages since it seems to simply close the connection following the response. Browsers are generally tolerant of this where many proxies, load balancers, and web application firewalls are not.

I can work around the error with {.add header|Connection: close.} in [error-page] in the template but I cannot work around the redirect issue in the template. I do not believe HFS uses chunked transfers at all so the second option shouldn't ever be needed. Depending on how the persistent connections option works, Content-length: 0 may be needed during redirects or when returning error pages also.

Thanks for a nice little utility!
Title: Re: Bug (2.3d): HTTP responses are not standards compliant
Post by: rejetto on October 12, 2014, 06:49:33 PM
i'm sorry, i will work on it.
I expect next update to include it but there's no ETA.
Title: Re: Bug (2.3d): HTTP responses are not standards compliant
Post by: gork on October 12, 2014, 11:20:32 PM
No need to apologize! I am happy to help track down the problem. Thanks for the fast response.

In the meantime I am running HFS behind stunnel which does not care about the underlying protocol.