Tutorial :Issue with File Download HTTP Headers in IE, when passed through nginx reverse proxy



Question:

Setup:

IIS7 serving ASP classic VB script code which generates a dynamic VSC page/file with headers to download.

Response.ContentType = "text/x-vCalendar"  Response.Expires = -1  Response.Buffer = True  Response.Clear  Response.AddHeader "Content-Disposition", "filename=" & strFileName & ".vcs;"  Response.Write strFileContent  

Our IIS7 serrvers are behind a nginx reverse proxy. Everything is working fine, except this file download.

Problem:

When using IE and going in through the reverse proxy (load balancer) the file is not downloading as a .vcs but wanting to download the .asp file/page.

When using other browsers through the reverse proxy (load balancer) it works fine.

When using IE and bypassing the reverse proxy (load balancer), going straight to the IIS server, it works fine.

Assumption:

Sounds like it's a HTTP header issue. The only differences I could find in the responses were the additional response headers of:

Connection: keep-alive  Vary: Accept-Encoding  

Header Responses:

HTTP/1.1 200 OK  Cache-Control: private  Content-Length: 1431  Content-Type: text/x-vCalendar  Expires: Fri, 09 Jul 2010 13:26:38 GMT  Server: Microsoft-IIS/7.5  Content-Disposition: filename=2507541_16268.vcs;  X-Powered-By: ASP.NET  backend: iis1  Date: Fri, 09 Jul 2010 13:27:37 GMT    HTTP/1.1 200 OK                                                     Connection: keep-alive  Vary: Accept-Encoding  Cache-Control: private  Content-Length: 1431  Content-Type: text/x-vCalendar  Expires: Fri, 09 Jul 2010 13:26:19 GMT  Server: nginx  Content-Disposition: filename=2507541_16268.vcs;  X-Powered-By: ASP.NET  backend: iis1  Date: Fri, 09 Jul 2010 13:27:15 GMT  

Request

Is there any light anyone can shed on the issue?

nginx settings to change, or ASP code to add?


Solution:1

So I finally figured this out, thought I'd post it for anyone else who needed the assist.

I commented out the gzip_vary line, from my nginx.conf file - that seemed to fix things but I chose not to set the setting to "off" because I didn't want to forcefully remove the Vary header from other browsers where things were working... commenting out worked.

# commenting this out seemed to work, but I could have set to: off  # gzip_vary on;   

additionally, I also told gzip to disable for IE6.

Gotcha: I found that specifying an expires header also caused problems. I suggest you comment out any expires directives while testing and figure out how to filter out as needed.

so, for good measure, here's the updated compression part of my conf for nginx

 ## Compression    gzip              on;    gzip_buffers      16 8k;    gzip_comp_level   6;    gzip_http_version 1.0;    gzip_min_length   0;    gzip_types        text/plain text/css image/x-icon text/html text/xml application/x-javascript;    #gzip_vary         on;    gzip_disable     "msie6";    gzip_proxied     any;  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »