# Partial Requests (206) on Reverse Proxy Cache

**URL:** <https://www.ruby-forum.com/t/partial-requests-206-on-reverse-proxy-cache/198908>\
**Category:** NGINX\
**Created:** [November 10, 2010, 2:04pm UTC](https://www.ruby-forum.com/t/partial-requests-206-on-reverse-proxy-cache/198908 "2010-11-10T14:04:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [November 10, 2010, 2:04pm UTC](https://www.ruby-forum.com/t/partial-requests-206-on-reverse-proxy-cache/198908/1 "2010-11-10T14:04:36Z")

</div>

Hi,

we use an nginx reverse proxy cache to serve media file downloads.  
An issue we currently have is that for the first uncached requests to  
the proxy, nginx is unable to respond to partial-requests and returns  
HTTP 200 instead which results in errors for some download clients.

Is there a workaround for this problem?

- Would it be possible when disabling sendfile or using direct i/o or  
forwarding uncached requests directly to the origins and caching in the  
background?

Thanks and kind regards,  
Nik

Posted at Nginx Forum:

> **[Partial Requests (206) on Reverse Proxy Cache](https://forum.nginx.org/read.php?2,149469,149469#msg-149469)**
>
> Hi, we use an nginx reverse proxy cache to serve media file downloads. An issue we currently have is that for the first uncached requests to the proxy, nginx is unable to respond to partial-requests and returns HTTP 200 instead which results in...

---

<div class="post-metadata">

**Author:** ![niwo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@niwo](https://www.ruby-forum.com/u/niwo)\
**Post date:** [November 10, 2010, 2:33pm UTC](https://www.ruby-forum.com/t/partial-requests-206-on-reverse-proxy-cache/198908/2 "2010-11-10T14:33:32Z")

</div>

Hello!

On Wed, Nov 10, 2010 at 08:03:04AM -0500, niwo wrote:

> Hi,
> 
> we use an nginx reverse proxy cache to serve media file downloads.  
> An issue we currently have is that for the first uncached requests to  
> the proxy, nginx is unable to respond to partial-requests and returns  
> HTTP 200 instead which results in errors for some download clients.

“Some download clients” probably have to be fixed, as 200 is  
allowed response for range requests.

> Is there a workaround for this problem?

You may pass Range requests to backends with something like

```
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;

```

and don’t cache responses to these requests at all:

```
proxy_no_cache $http_range $http_if_range;

```

Maxim D.

---

<div class="post-metadata">

**Author:** ![niwo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@niwo](https://www.ruby-forum.com/u/niwo)\
**Post date:** [November 11, 2010, 10:17pm UTC](https://www.ruby-forum.com/t/partial-requests-206-on-reverse-proxy-cache/198908/3 "2010-11-11T22:17:13Z")

</div>

On Wed, Nov 10, 2010 at 7:32 AM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> and don’t cache responses to these requests at all:
> 
> proxy\_no\_cache $http\_range $http\_if\_range;

Should nginx honor “Range” requests for files that are in cache  
locally? 0.7.67 doesn’t seem to do so in my testing. In fact, it  
always seems to send 200 with the entire file, even for static files  
that are hosted on the local file system.

Is Range support unimplemented?

–  
RPM

---

<div class="post-metadata">

**Author:** ![niwo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@niwo](https://www.ruby-forum.com/u/niwo)\
**Post date:** [November 12, 2010, 3:19pm UTC](https://www.ruby-forum.com/t/partial-requests-206-on-reverse-proxy-cache/198908/4 "2010-11-12T15:19:14Z")

</div>

2010/11/11 Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Most likely you tested it wrong.
> 
> > Is Range support unimplemented?
> 
> It is, and works ok here.

## Oops, you’re quite correct. I was testing it wrong. I goofed the syntax of the Range header (using “Range: 0-100” instead of “Range: bytes=0-100”). My apologies, I misunderstood that the explicit “bytes-unit” is required by RFC 2616, even though the RFC defines “bytes” and no other range units.

RPM

---

<div class="post-metadata">

**Author:** ![niwo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@niwo](https://www.ruby-forum.com/u/niwo)\
**Post date:** [November 12, 2010, 1:10am UTC](https://www.ruby-forum.com/t/partial-requests-206-on-reverse-proxy-cache/198908/5 "2010-11-12T01:10:49Z")

</div>

Hello!

On Thu, Nov 11, 2010 at 03:16:11PM -0600, Ryan M. wrote:

> > and don’t cache responses to these requests at all:
> > 
> > proxy\_no\_cache $http\_range $http\_if\_range;
> 
> Should nginx honor “Range” requests for files that are in cache  
> locally? 0.7.67 doesn’t seem to do so in my testing. In fact, it

It does so as long as response in cache has Content-Length header.

> always seems to send 200 with the entire file, even for static files  
> that are hosted on the local file system.

Most likely you tested it wrong.

> Is Range support unimplemented?

It is, and works ok here.

GET / HTTP/1.1  
Host: localhost  
Range: bytes=0-10

HTTP/1.1 206 Partial Content  
Server: nginx/0.8.53  
Date: Fri, 12 Nov 2010 00:04:34 GMT  
Content-Type: text/html  
Content-Length: 11  
Connection: keep-alive  
Last-Modified: Sat, 30 Aug 2008 11:12:56 GMT  
Content-Range: bytes 0-10/1445
