-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support HEAD requests #22
Comments
@evanmiller, any idea what the problem could be? |
@vongruenigen, IMO it is not related with mod_zip at all. The module it is exactly pointing the cause of the problem - no content from upstream. If your application server is HTTP 1.1 standard compliant it may run some body generating content but for sure it won't sent any content back to nginx. http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4 I suppose the solution is to convert any upstream HEAD requests to GET.
If that helps you please share the result here. I need to update my configs to support HEAD soon as well. |
@pgaertig, thanks for the detective work. It would be nice if mod_zip supported HEAD requests out of the box. This is not something I plan to work on but patches welcome. |
I have tried "proxy_method GET;" and it is bad. Nginx is responding with ZIP body for HEAD :/ |
I have put this quickly
instead of line https://github.com/evanmiller/mod_zip/blob/master/ngx_http_zip_module.c#L543 Below is an example curl to play with it. It should return expected
|
@pgaertig, thanks for investigating. I'll try your patch as soon as I've some spare time. |
It looks IMHO like the HEAD request to the backend (upstream) returns no content but a header Line 543 might be too late to catch this - the response body is already parsed on line 511 and mod_zip will throw an error. We might check for HEAD requests early at https://github.com/evanmiller/mod_zip/blob/master/ngx_http_zip_module.c#L484 and return there. |
My patch attempt should be really used with If you want to not return any meaningful data and headers then I am almost sure HEAD is used by JDownloader and other downloading software to check file availability and properties without actually downloading it. |
Good point - our client is actually a iOS newsstand application which checks the URL with a HEAD before downloading. |
I'm also affected by this error. I'm generating the responses to enable mod_zip with a php file. As far as I can tell, most applications which do a HEAD request at start can handle this behaviour just fine, but that's not a solution which I would accept permanently. |
And here I was thinking this was about mod_zip sending |
We witness a strange behaviour of
mod_zip
when different HTTP methods are used.If I make a GET request to our application, it correctly generates the file list and sends it back to nginx, which then generates the ZIP file and sends it back to the client. Everything working as expected and nginx does not log any error or similar.
Now, I'll do the same request, but this time as a HEAD request. The request hits our application, it generates the exact same file list and sends it back to nginx. But this time nginx logs the following error:
The interessting thing is that our application is not able to differ between HEAD and GET requests. So the HEAD request is handled exactly the same way as the (working) GET request is.
The text was updated successfully, but these errors were encountered: