<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>are Range requests for dynamic content supported?</title>
<description>Hi,
I'm wondering if nginx supports Range requests for dynamic content
(say, from a Rails app via Passenger).
I've tried it out with static content, and it works as expected.  When
hitting a URL with dynamic content, however, nginx seems to ignore the
Range header, and it does not include a Accept-Ranges header in the
response. I did notice that Rails was not returning a Content-Length
header, so I fixed that. However, even with this header, I get the
same results.
I'm thinking the answer to this question is no, but I would like to
get some confirmation. Thanks!
-David
--
David van Geest
Software Engineer
Spindance, Inc.
616.355.7000 x113
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx</description><link>http://forum.nginx.org/read.php?2,225952,225952#msg-225952</link><lastBuildDate>Tue, 21 May 2013 19:54:20 -0400</lastBuildDate>
<generator>Phorum 5.2.16</generator>
<item>
<guid>http://forum.nginx.org/read.php?2,225952,225992#msg-225992</guid>
<title>Re: are Range requests for dynamic content supported?</title><link>http://forum.nginx.org/read.php?2,225952,225992#msg-225992</link><description><![CDATA[On Wed, May 2, 2012 at 2:42 PM, Lukas Tribus &lt;luky-37@hotmail.com&gt; wrote:<br />&gt;<br />&gt;&gt; The HTTP client in<br />&gt;&gt; this case is (always) a very particular embedded device with limited<br />&gt;&gt; resources and a constrained operating environment.<br />&gt;<br />&gt; Ok, so this is about working around a broken user-agent. I assume the vendor of that embedded device can't fix the crashing client?<br /><br />Correct :-).<br /><br />&gt; How do you force the client to request the content in Byte-Ranges and not at once? Even if you are serving static files from the server (where nginx can provide most of the HTTP/1.1 features), the client actually needs to request it that way.<br /><br />The developer of the embedded application has some control over the<br />HTTP requests, and thinks he can force it to use Byte-Ranges.<br /><br />&gt;&gt; It has yet to be seen whether this<br />&gt;&gt; will solve the client crashing issues, so for now I'm going to leave<br />&gt;&gt; it.<br />&gt;<br />&gt; Meaning you still aren't sure whether range support will fix your client crashing issue? I would look for other workarounds, like heavy gzipping, (if x/html) minifying and outsourcing as much as possible in other files (css and stuff), etc. You already implemented checksumming on the client-side, maybe you can implement some segmenting in the application code as well, instead of relaying on HTTP to do that job via Range requests.<br /><br />Right. Gzipping may be another option... the response is purely JSON,<br />but should be very compressible. The question would probably come<br />down to space on the embedded device for a gzip library (sigh...). We<br />want to avoid large application changes but segmenting there is<br />another option. Thanks for the suggestions!<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>David van Geest</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 14:52:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225952,225991#msg-225991</guid>
<title>RE: are Range requests for dynamic content supported?</title><link>http://forum.nginx.org/read.php?2,225952,225991#msg-225991</link><description><![CDATA[&gt; The HTTP client in<br />&gt; this case is (always) a very particular embedded device with limited<br />&gt; resources and a constrained operating environment.<br /><br />Ok, so this is about working around a broken user-agent. I assume the vendor of that embedded device can't fix the crashing client?<br /><br />How do you force the client to request the content in Byte-Ranges and not at once? Even if you are serving static files from the server (where nginx can provide most of the HTTP/1.1 features), the client actually needs to request it that way.<br /><br /><br />&gt; It has yet to be seen whether this<br />&gt; will solve the client crashing issues, so for now I'm going to leave<br />&gt; it.<br /><br />Meaning you still aren't sure whether range support will fix your client crashing issue? I would look for other workarounds, like heavy gzipping, (if x/html) minifying and outsourcing as much as possible in other files (css and stuff), etc. You already implemented checksumming on the client-side, maybe you can implement some segmenting in the application code as well, instead of relaying on HTTP to do that job via Range requests.<br /><br /><br />BR,<br /><br />Lukas<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Lukas Tribus</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 14:44:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225952,225989#msg-225989</guid>
<title>Re: are Range requests for dynamic content supported?</title><link>http://forum.nginx.org/read.php?2,225952,225989#msg-225989</link><description><![CDATA[On Wed, May 2, 2012 at 1:31 PM, Lukas Tribus &lt;luky-37@hotmail.com&gt; wrote:<br />&gt;<br />&gt; Its about stale data in the client. If the HTTP client request an exact byte-range, then this particular byte-range was chosen because of a reason, like the moov atom in mp4 files; the header of a pdf file or similar stuff (depending on the content-type). Here is the problem: when the client reads the first bytes of the PDF today, and the user scrolls down tomorrow (adobe reader makes heavy use of range requests iirc), the pdf on the server needs to be exactly the same (bit for bit). If its not, the byte-range request must not be successful, otherwise the application will get corrupt data (how can the byte offset still be the same with the file from yesterday if the content changed on the server). This is the reason why the HTTP server needs to validate the client-side cache with things like filemtime. If we can't validate the client cache, we can't serve 206 partial content. In case of dynamic content we have no way to do this (theoretically it would be doable with etag stro<br />&gt;  ng validation, but nginx doesn't support it and your application surely doesn't either).<br /><br />Yeah, this is a reason why it _shouldn't_ be done in most cases...<br />technically it's still feasible, but I guess I'll accept &quot;shouldn't&quot;<br />as &quot;can't&quot;. We manage to get around this kind of situation by using<br />checksums to validate the entire HTTP body once it's been delivered in<br />its entirety. The checksums are originally for something else<br />entirely, but that's a different story.<br /><br />&gt; Iirc, (please correct me if I'm wrong), nginx, when configured as a caching reverse proxy serves 206 only when the object is already in the local nginx cache. If its not there, full file will be served.<br /><br />I don't think nginx as we have it configured would qualify as a<br />caching reverse proxy - it's a pretty standard nginx + passenger<br />install. I did try it with a static file and Range requests worked as<br />expected.<br /><br />&gt; Also read HTTP/1.1 specs in [1].<br /><br />I've read it, and am using it for reference, but I don't see anything<br />that specifically addresses the question of dynamic content.<br /><br />&gt; Can you tell us more about your use case? Is your dynamic content really that big? Maybe you are approaching this from the wrong side, x-accel-redirect can probably help here, as Ensiferous already posted.<br /><br />Yeah, a bit of context would probably help here. The HTTP client in<br />this case is (always) a very particular embedded device with limited<br />resources and a constrained operating environment. A response at the<br />extreme end of the scale could be 200 K, and this apparently causes<br />the client to croak (for reasons that are a little unclear to me). It<br />was suggested that if we could break up the response into smaller<br />pieces, it may solve the issue. This is just one avenue we're<br />exploring.<br /><br />For the moment, I did get this to work by adapting the Rack middleware<br />Racknga::Middleware::Range I found here:<br />http://groonga.rubyforge.org/. It has yet to be seen whether this<br />will solve the client crashing issues, so for now I'm going to leave<br />it.<br /><br />Thanks for your response!<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>David van Geest</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 14:00:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225952,225987#msg-225987</guid>
<title>RE: are Range requests for dynamic content supported?</title><link>http://forum.nginx.org/read.php?2,225952,225987#msg-225987</link><description><![CDATA[Its about stale data in the client. If the HTTP client request an exact byte-range, then this particular byte-range was chosen because of a reason, like the moov atom in mp4 files; the header of a pdf file or similar stuff (depending on the content-type). Here is the problem: when the client reads the first bytes of the PDF today, and the user scrolls down tomorrow (adobe reader makes heavy use of range requests iirc), the pdf on the server needs to be exactly the same (bit for bit). If its not, the byte-range request must not be successful, otherwise the application will get corrupt data (how can the byte offset still be the same with the file from yesterday if the content changed on the server). This is the reason why the HTTP server needs to validate the client-side cache with things like filemtime. If we can't validate the client cache, we can't serve 206 partial content. In case of dynamic content we have no way to do this (theoretically it would be doable with etag stro<br />ng validation, but nginx doesn't support it and your application surely doesn't either).<br /><br />Iirc, (please correct me if I'm wrong), nginx, when configured as a caching reverse proxy serves 206 only when the object is already in the local nginx cache. If its not there, full file will be served.<br /><br /><br />Also read HTTP/1.1 specs in [1].<br /><br /><br />Can you tell us more about your use case? Is your dynamic content really that big? Maybe you are approaching this from the wrong side, x-accel-redirect can probably help here, as Ensiferous already posted.<br /><br /><br /><br />[1] http://tools.ietf.org/html/rfc2616#section-10.2.7<br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Lukas Tribus</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 13:32:00 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225952,225977#msg-225977</guid>
<title>Re: are Range requests for dynamic content supported?</title><link>http://forum.nginx.org/read.php?2,225952,225977#msg-225977</link><description><![CDATA[On Tue, May 1, 2012 at 9:45 PM, Ensiferous &lt;nginx-forum@nginx.us&gt; wrote:<br />&gt; Your backend is responsible for returning the proper data, it can't<br />&gt; return the entire data and then expect nginx to send only part of it.<br /><br />Why can't nginx do this? Technically it seems entirely feasible.<br />Partial Content is an HTTP feature so it seems logical to keep this<br />with the HTTP server.<br /><br />&gt; What you should actually do, if at all possible, is to use the<br />&gt; x-accel-redirect to direct nginx to the content location so that it can<br />&gt; read the file itself instead of getting it from your backend.<br /><br />There is no file or content location, this is dynamic content pulled<br />from a DB. Maybe I'm misunderstanding your suggestion though....<br /><br />Thanks for the reply!<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>David van Geest</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 02 May 2012 09:24:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225952,225956#msg-225956</guid>
<title>Re: are Range requests for dynamic content supported?</title><link>http://forum.nginx.org/read.php?2,225952,225956#msg-225956</link><description><![CDATA[Your backend is responsible for returning the proper data, it can't return the entire data and then expect nginx to send only part of it.<br /><br />What you should actually do, if at all possible, is to use the x-accel-redirect to direct nginx to the content location so that it can read the file itself instead of getting it from your backend.]]></description>
<dc:creator>Ensiferous</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Tue, 01 May 2012 21:45:17 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,225952,225952#msg-225952</guid>
<title>are Range requests for dynamic content supported?</title><link>http://forum.nginx.org/read.php?2,225952,225952#msg-225952</link><description><![CDATA[Hi,<br /><br />I'm wondering if nginx supports Range requests for dynamic content<br />(say, from a Rails app via Passenger).<br /><br />I've tried it out with static content, and it works as expected.  When<br />hitting a URL with dynamic content, however, nginx seems to ignore the<br />Range header, and it does not include a Accept-Ranges header in the<br />response. I did notice that Rails was not returning a Content-Length<br />header, so I fixed that. However, even with this header, I get the<br />same results.<br /><br />I'm thinking the answer to this question is no, but I would like to<br />get some confirmation. Thanks!<br /><br />-David<br /><br />--<br />David van Geest<br />Software Engineer<br />Spindance, Inc.<br />616.355.7000 x113<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>David van Geest</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Tue, 01 May 2012 17:54:00 -0400</pubDate></item>
</channel>
</rss>