Using Content-MD5 header
Matthijs Langenberg
lists at ruby-forum.com
Thu Jul 24 23:44:24 MSD 2008
Igor Sysoev wrote:
> On Mon, Jul 21, 2008 at 01:37:56PM +0200, Matthijs Langenberg wrote:
>
>> I would like to use the Content-MD5 header from a HTTP response, does
>> Nginx provide a way to add the 'Content-MD5' header to the response for
>> a static file request?
>
> No, nginx does not support Content-MD5 header.
> Calculating MD5 means that nginx must read whole file before sending it
> to client.
>
> What purpose of this header ?
Igor,
I'm writing an app that handles file uploads (assets storage) from other
machines in the network, mostly done by batch processing. I'm using a
HEAD request to check if a file already is uploaded, but it's hard to
monitor which files already have been edited and need to be uploaded
again.
By using the Content-MD5 header and a locally calculated MD5 checksum, I
can easily check if a file is outdated.
Ofcourse there are other solutions to this problem:
I could also do a GET request to http://some/image.gif/md5, to hit an
app which calculates the MD5 on request, so nginx doesn't need to
calculate the MD5 all the time, even for requests that don't use it.
Or I could prepend the filename with (a part) of the MD5 hash. This
means that I could do a cheap HEAD to http://some/a34sdfs3-image.gif to
see if my image already exists.
Would it be expensive to add a md5 calculation for static files?
--
Posted via http://www.ruby-forum.com/.
More information about the nginx
mailing list