Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Remove declaration of support for HTTP range requests #174

Merged
merged 1 commit into from
Dec 10, 2014

Conversation

jwoyame
Copy link
Contributor

@jwoyame jwoyame commented Dec 9, 2014

The problem

When a resource response includes an "Accept-Ranges" HTTP header, the proxy will forward this header to the client. The browser interprets this to mean that requests for partial content can be made on that resource. The browser may then perform a range request, using the "Range" header. For instance:

Range:bytes=32768-862445

When the proxy receives this request, it does not forward the desired range to the target server.

An example

When a PDF is requested through the proxy, the server will return the full content of the PDF file, but will include an Accept-Ranges header to indicate that partial data ranges can be requested. PDF viewers (Adobe / Chrome) will notice the header and perform a partial range request for the first 32k or so of the file. Since the proxy does not support these queries, the PDF download will hang.
http://serverfault.com/questions/61424/why-are-we-seeing-apache-206-partial-responses-for-pdf-downloads

The fix

The DotNet proxy has been modified so as to not to forward the "Accept-Range" header to the client.

Other solutions

A better solution would be to forward all request headers to the target server, with the exception of those set by the proxy script. It would be very similar to how the copyHeaders function works, but would operate on request headers instead of response headers. This would require changing the design of the script.

Here is an explanation for how the Accept-Ranges header works: http://benramsey.com/blog/2008/05/206-partial-content-and-range-requests/

@bsvensson
Copy link
Member

Thanks @jwoyame for a great write-up.

Any chance you also tried the php and/or iis proxies?

Is this resource response (with range request) for an "ArcGIS for Server", or some other software?

@phpmaps
Copy link

phpmaps commented Dec 10, 2014

I second that... nice write up. Thank you for the contribution. @jwoyame

@jwoyame
Copy link
Contributor Author

jwoyame commented Dec 10, 2014

It is a long write-up for one line of code ;)

Most, if not all modern Web servers should be returning an "Accepts-Ranges" header with their binary data responses. I can confirm that IIS 7.5 does. This is typically not an issue for the proxy, as range requests are usually made only for video files or other large content. However, I was trying to return PDF files generated by a geoprocessor, and Chrome will fail on this, as it uses a Range request to stream in the first few pages of PDF content. Eliminating the Accepts-Ranges forces Chrome to load the whole PDF.

I have unfortunately not looked at the PHP or Java versions, but if they are not forwarding the "Range" headers, then they have a similar issue.

bsvensson added a commit that referenced this pull request Dec 10, 2014
Remove declaration of support for HTTP range requests
@bsvensson bsvensson merged commit 221950a into Esri:master Dec 10, 2014
@bsvensson bsvensson added this to the 1.1 milestone Aug 11, 2015
This was referenced Aug 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants