Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.Clear();
Response.ContentType = "binary/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + downloadName + "; size=" + downloadBytes.Length);
Response.OutputStream.Write(downloadBytes, 0, downloadBytes.Length);
Response.End();

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
ServerName www.example.com

ProxyVia On
ProxyPass / http://127.0.0.1:5000/ timeout=360
ProxyPassReverse / http://127.0.0.1:5000/
ProxyPreserveHost On
LogLevel debug

share|improve this question
add comment

2 Answers

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
add comment

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 http://backend.example.com

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

share|improve this answer
add comment

Your Answer

 
discard

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