Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We recently setup an apache reverse proxy with IIS sitting behind it. All of our apps work fine except for one.

In one app we will prepare and stream a PDF file to the user with the follow example code:

Response.ContentType = "binary/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + downloadName + "; size=" + downloadBytes.Length);
Response.OutputStream.Write(downloadBytes, 0, downloadBytes.Length);

The app will seem to hang and never stream the PDF. The app works fine with no proxy. And also if I take a pdf of the same size and store it on the server's file systems and then download from that directory it works fine. It seems to only have a problem when we try to stream using Response.

I suspected the connection wasn't being kept alive while the PDF generated (it takes about 5 to 7 seconds) but I have adjust the timeout and had no luck.

Here is my apache proxy config.

<VirtualHost *:443>

<Proxy *>

Order deny,allow Allow from all

SSLEngine on
SSLCertificateFile C:/certs/example.crt
SSLCertificateKeyFile c:/certs/example.key

ProxyVia On
ProxyPass / timeout=360
ProxyPassReverse /
ProxyPreserveHost On
LogLevel debug

share|improve this question

So I solved my problem.

There was an internal process in the application that would use self referencing URLs to generate the PDF.

I had proxypreservehost on which was causing the PDF process to timeout because of some bad URLs it was generating.

I disabled proxypreservehost and it works like a charm!

share|improve this answer
+1 for coming back and answering your own question. Good etiquette! – Mark Henderson Aug 28 '09 at 5:22

What about excluding the pdf file using the following '!' directive from mod_proxy manual?

The ! directive is useful in situations where you don't want to reverse-proxy a subdirectory, e.g.

ProxyPass /mirror/foo/i ! ProxyPass /mirror/foo

will proxy all requests to /mirror/foo to except requests made to /mirror/foo/i.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.