I've setup a reverse proxy server in an azure cloud service using IIS rewrite rules and the Application Request Routing module (according to the instructions here. Everything is working well except for calls to endpoints I've created to download mp4 files. These endpoints can serve up partial content when the request contains the Range header. The problem I'm having is that when I hit the server directly, it correctly responds with 206 (partial content) and the correct range of bytes, but sometimes when I hit the endpoints through the proxy server, it responds with a 200, and the full file contents, which causes errors in video playback in Chrome.
Example: When hitting the server directly with a request like this:
GET server.domain.com/api/adFile/fileName With header: Range: bytes=168-3922822
I correctly receive a 206 response. Here are some of the relevant headers in the response:
- Cache-Control: no-cache
- Pragma: no-cache
- Content-Length: 3922655
- Content-Type: video/mp4
- Content-MD5: f1+K8OT8TEjvtlPU5iUY8a==
- Content-Range: bytes 168-3922822/3922823
- Expires: -1
- Last-Modified: Tue, 16 Feb 2016 15:46:46 GMT
- ETag: "0x8D336E86040C217"
- Server: Microsoft-IIS/8.0
- X-AspNet-Version: 4.0.30319
- X-Powered-By: ASP.NET
When hitting the server through the reverse proxy, with a request like this:
GET proxy.domain.com/api/adFile/fileName With header: Range: bytes=168-3922822
I incorrectly receive a 200 status code and the full file contents. here are the relevant headers from that response:
- Cache-Control: no-cache
- Pragma: no-cache
- Content-Length: 3922823
- Content-Type: video/mp4
- Content-MD5: f1+K8OT8TEjvtlPU5iUY8a==
- Expires: -1 Last-Modified: Tue, 16 Feb 2016 15:46:46 GMT
- ETag: "0x8D336E86040C217"
- Server: Microsoft-IIS/8.5
- X-AspNet-Version: 4.0.30319
- X-Powered-By: ASP.NET
- X-Powered-By: ARR/3.0
- X-Powered-By: ASP.NET
Is there any way that I can modify the proxy behavior to match the behavior of the main server (i.e. return just the partial content requested)? It seems that it might be caching the file contents and serving all of them when the requested byte range is close to the full file size.