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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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/