View a pdf with quick webview though apache proxy

Posted by Musa on Server Fault See other posts from Server Fault or by Musa
Published on 2014-08-25T14:17:22Z Indexed on 2014/08/25 16:22 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

I have a site(IIS) that is accessed via a proxy in apache(on an IBM i). This site serves PDFs which has quick web view and if I access a pdf directly from the IIS server the PDFs starts to display immediately but if I go through the proxy I have to wait until the entire pdf downloads before I can view it.
In the apache config file I use

ProxyPass /path/ http://xxx.xxx.xxx.xxx/
<LocationMatch "/path/">
    Header set Cache-Control "no-cache"
</LocationMatch>

I tried adding SetEnv proxy-sendcl to LocationMatch directive this had no effect.

The PDFs that view quickly makes a lot of partial requests
This is the initial request and response headers

GET http://xxx.xxx.xxx.xxx/xxx.PDF HTTP/1.1
Host: xxx.xxx.xxx.xxx
Proxy-Connection: keep-alive
Cache-Control: no-cache
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.2; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: chocolatechip

HTTP/1.1 200 OK
Via: 1.1 xxxxxxxx
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 15330238
Date: Mon, 25 Aug 2014 12:48:31 GMT
Content-Type: application/pdf
ETag: "b6262940bbecf1:0"
Server: Microsoft-IIS/7.5
Last-Modified: Fri, 22 Aug 2014 13:16:14 GMT
Accept-Ranges: bytes
X-Powered-By: ASP.NET   

This is a partial request and response

GET http://xxx.xxx.xxx.xxx/xxx.PDF HTTP/1.1
Host: xxx.xxx.xxx.xxx
Proxy-Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.2; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Accept: */*
Referer: http://xxx.xxx.xxx.xxx/xxxx.PDF
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: chocolatechip
Range: bytes=0-32767

HTTP/1.1 206 Partial Content
Via: 1.1 xxxxxxxx
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 32768
Date: Mon, 25 Aug 2014 12:48:31 GMT
Content-Range: bytes 0-32767/15330238
Content-Type: application/pdf
ETag: "b6262940bbecf1:0"
Server: Microsoft-IIS/7.5
Last-Modified: Fri, 22 Aug 2014 13:16:14 GMT
Accept-Ranges: bytes
X-Powered-By: ASP.NET

These are the headers I get if I go through he proxy

GET /path/xxx.PDF HTTP/1.1
Host: domain:xxxx
Connection: keep-alive
Cache-Control: no-cache
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.2; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

HTTP/1.1 200 OK
Date: Mon, 25 Aug 2014 13:28:42 GMT
Server: Microsoft-IIS/7.5
Content-Type: application/pdf
Last-Modified: Fri, 22 Aug 2014 13:16:14 GMT
Accept-Ranges: bytes
ETag: "b6262940bbecf1:0"-gzip
X-Powered-By: ASP.NET
Cache-Control: no-cache
Expires: Thu, 24 Aug 2017 13:28:42 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Keep-Alive: timeout=300, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked

I'm guessing its because the proxy uses Transfer-Encoding: chunked but I'm not sure and wasn't able to turn it off to check.

Browser Chrome 36.0.1985.143 m Using the native PDF viewer

Any help to get the pdf quick web view through the proxy working would be appreciated.

© Server Fault or respective owner

Related posts about apache-2.2

Related posts about reverse-proxy