I have nginx 1.0.5 set up as a proxy in front of a Ruby/Ramaze
application, using X-Accel-Redirect to efficiently handle sending large
binary files by handing those transfers over to nginx. Range requests
against this setup work just fine, but “If-Range” headers from the
client are ignored – the server always returns the requested range,
even when the If-Range date doesn’t match the file’s Last-Modified date.
The problem seems to be due to this line in our config:
This sets the Last-Modified date on file sent to the client to the value
sent to nginx from Ruby. With this line in the config, I get the
If-Range issue described above. If I comment this out, Last-Modified is
taken from the file’s mtime instead, but If-Range works.
This sets the Last-Modified date on file sent to the client to the
value sent to nginx from Ruby. With this line in the config, I get
the If-Range issue described above. If I comment this out,
Last-Modified is taken from the file’s mtime instead, but If-Range
works.
I have nginx 1.0.5 set up as a proxy in front of a Ruby/Ramaze
application, using X-Accel-Redirect to efficiently handle sending large
binary files by handing those transfers over to nginx. Range requests
against this setup work just fine, but “If-Range” headers from the
client are ignored – the server always returns the requested range,
even when the If-Range date doesn’t match the file’s Last-Modified date.
Hi again,
I spent some time looking in to this and created a patch that seems to
fix the problem for me. The issue was in “ngx_http_set_last_modified” in
http/modules/ngx_http_headers_filter_module.c – last_modified_time gets
set to -1 and is then never updated with the new value.
I have no idea how correct this patch is, so I’d greatly appreciate it
if someone could review this for me.
Thanks Maxim – your patch has fixed the problem for me. I feel a little
silly for spending the time to come up with my own patch, but at least I
know more about nginx now than I did this morning
Thanks
Leigh
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.