IE6 problems when using gzip_disable

Hello-
I am new to nginx, so this may be a silly question. I set up gzip with
the recommended ‘gzip_disable “MSIE [1-6].”’ parameter. But this
results in long delays and/or “IE cannot download” errors when used with
keepalive and other gzip options. It only seems to affect js files, and
if I rename the files to .txt extensions they have no problems. Does
this mean that gzip doesn’t need to be disabled for IE6 any more? Or am
I doing something wrong somewhere else in my configuration?

Here is a description of the behavior and a debug log.
When trying to download the static .js file for my site, it takes 30
seconds to complete in IE6, compared to almost instant in
chrome/firefox. This 30 second duration depends on the keepalive_timeout
setting, which I have at 35. If I change that to 75, the download take
70 seconds to complete. If I change it to 0, the download completes
right away. This affects files with the .js extension, but other files
don’t have this problem (.txt, .html). The debug log for 2 download
attempts using IE6 (no service packs applied), first for the file with
extension .txt and then for a file with extension .js:

here is my nginx.conf with some comments inline:

# disable user and pid here. using runit's chpst command instead
#user  nginx;
#pid        /var/run/nginx.pid;
daemon  off;

worker_processes  1;
events {
    worker_connections  1024;
}

error_log  /var/log/nginx/debug.log debug;

http {
    include       /opt/nginx/conf/mime.types;
    default_type  application/octet-stream;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         off;

    keepalive_timeout   35;

    gzip                on; # if on, IE6 can't download the js file
    gzip_disable        "MSIE [1-6]\.";
    #gzip_disable        "MSIE [1-6].(?!.*SV1)"; # same problem with
this version
    #gzip_vary           on; # this causes IE to fail entirely (not a
delay)
    gzip_http_version   1.1;
    gzip_comp_level     2;
    gzip_buffers        16 8k; # necessary to work with gzip files
larger than 32k
    #gzip_static         on; # requires ./configure ...
--with-http_gzip_static_module
                            # and timestamps of .gz files should match
uncompressed
    # automatically includes type text/html
    gzip_types        text/plain text/css
                        application/x-javascript text/xml
                        application/xml application/xml+rss
                        text/javascript;

    include             /etc/nginx/sites-available/*;

}

In the sites-available directory, this is the only file:

# Configuration file for nginx web server

#gzip_min_length 500;
#gzip_proxied    any; # compress info from nodejs server

upstream nodejs_server {
  server 127.0.0.1:8124;
}

server {
    listen 8090; # for testing. can disable this line to listen on 80
    server_name localhost; # for testing, we use the IP address
    access_log  /var/log/nginx/access.log;

    root  /home/dbro/public;
    index    index.html;
    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;

    # serve static files, and fallback to index.html
    location / {
      try_files $uri $uri/ index.html;
      #expires 1d; # TODO: increase this cache timeout
    }

    # requests handled by node.js
    location = /a {
      proxy_pass     http://nodejs_server;
    }
    location = /e {
      proxy_pass     http://nodejs_server;
    }

}

Thanks very much for help.
Dan

Posted at Nginx Forum:

On 20 Jan 2011 18h13 WET, [email protected] wrote:

Hello- I am new to nginx, so this may be a silly question. I set up
gzip with the recommended ‘gzip_disable “MSIE [1-6].”’

As you can read in
http://wiki.nginx.org/NginxHttpGzipModule#gzip_disable
since Nginx version >= 0.7.63 the preferred form of the directive is:

gzip_disable “msie6”;

— appa

Thanks Antonio. After making that change, I see the same problem
behavior.
Dan

Posted at Nginx Forum:

Hello!

On Thu, Jan 20, 2011 at 01:13:47PM -0500, dbro wrote:

Hello-
I am new to nginx, so this may be a silly question. I set up gzip with
the recommended ‘gzip_disable “MSIE [1-6].”’ parameter. But this

Just a side note: use “msie6” special mask instead.

setting, which I have at 35. If I change that to 75, the download take
70 seconds to complete. If I change it to 0, the download completes
right away. This affects files with the .js extension, but other files
don’t have this problem (.txt, .html). The debug log for 2 download
attempts using IE6 (no service packs applied), first for the file with
extension .txt and then for a file with extension .js:

Looking though logs suggests that there is nothing wrong at nginx
side: it sent the whole file.

Probably (at least your installation of) IE6 has problems with
downloading (big?) .js files over keepalive connections. Gzip has
mostly nothing to do with it as 1) it’s disabled as expected, 2)
one can’t rely on content being gzipped all over the net anyway
and 3) having problems with non-gzipped content doesn’t mean there
are no problems with gzipped one.

You may want to check the following:

  1. If size or actual javascript content matters (i.e. if using
    smaller or simplier file makes any difference).

  2. If removing gzip completely makes any difference.

  3. If using another web server with keepalive support makes any
    difference.

  4. If your IE6 installation is able to cache files (and time is
    set correctly). Note that most of the problems with “IE can’t
    download file” seems to be caused by “can’t save to disk but need
    to” problem, see here:

Maxim D.

Thanks for the suggestions Maxim. I think there is some progress
described below:

Maxim D. Wrote:

are no problems with gzipped one.
I’m not sure I understand what you mean. It seems like gzip is involved
in the problem, either on IE’s end or nginx’s end, based on this
summary:
With nginx conf file having “gzip off;”, the problem exists (for .js
files. other files work OK)
With ‘gzip on; gzip_disable “msie6”’, the problem exists (for .js files.
other files work OK)
Keeping “gzip on;” and removing ‘gzip_disable “msie6”’, fixes the
problem for .js files, and other files continue to work OK.

You may want to check the following:

  1. If size or actual javascript content matters
    (i.e. if using
    smaller or simplier file makes any difference).
    Yes! I created a test file with a single javascript command (alert(‘test
    message’):wink: followed by a long block comment. When the text file’s size
    was less than 2596 bytes (gzip’d file was 719 bytes), it worked just
    fine. Any larger, even by a single character, and it would show the same
    delay as before. What does this mean?
  1. If removing gzip completely makes any
    difference.
    See above. the problem exists when nginx’s conf file has “gzip off;”
    too.
  1. If using another web server with keepalive
    support makes any
    difference.
    I havent tried this
  1. If your IE6 installation is able to cache files
    (and time is
    set correctly). Note that most of the problems
    with “IE can’t
    download file” seems to be caused by “can’t save
    to disk but need
    to” problem, see here:

"Internet Explorer Cannot Download" Error Message When You Use an HTTPS URL to Open an Office Document or PDF File - Microsoft Support
This souded like a different problem, involving https. In any case, they
recommend unchecking a box to fix it (if I read it correctly), and it
was already unchecked in the IE options.

Posted at Nginx Forum:

Hello!

On Thu, Jan 20, 2011 at 05:41:48PM -0500, dbro wrote:

as expected, 2)
files. other files work OK)
With ‘gzip on; gzip_disable “msie6”’, the problem exists (for .js files.
other files work OK)
Keeping “gzip on;” and removing ‘gzip_disable “msie6”’, fixes the
problem for .js files, and other files continue to work OK.

The fact that switching gzip on resolves the problem doesn’t mean
that it’s gzip-related problem. It’s just a problem which happens
to disappear for some reason once you enable gzip.

Possible reasons why it disappears include:

  1. Other code path in IE for gzipped content.

  2. Other code path in IE due to chunked encoding (which gzip
    uses). You may want to test with gzip_static to see if the
    problem reappears with it, as gzip_static won’t trigger
    gzip_static. And you may want to test if using ssi and/or sub
    filters will resolve problem.

  3. Just a smaller size of gzipped responses, i.e. using bigger
    files will trigger the problem with gzip as well.

You may want to check the following:

  1. If size or actual javascript content matters
    (i.e. if using
    smaller or simplier file makes any difference).
    Yes! I created a test file with a single javascript command (alert(‘test
    message’):wink: followed by a long block comment. When the text file’s size
    was less than 2596 bytes (gzip’d file was 719 bytes), it worked just
    fine. Any larger, even by a single character, and it would show the same
    delay as before. What does this mean?

Looks like buffering problem in IE, as initially suspected.

Do the problem reappear at some point even with gzip enabled (i.e.
when gzipped size exceeds some threshold)?

  1. If removing gzip completely makes any
    difference.
    See above. the problem exists when nginx’s conf file has “gzip off;”
    too.
  1. If using another web server with keepalive
    support makes any
    difference.
    I havent tried this

You may want to. As well as checking if the problem appears on
other installations of the same version of IE6, and other versions
of it.

recommend unchecking a box to fix it (if I read it correctly), and it
was already unchecked in the IE options.

As you may see there, unchecking a box isn’t enough: the same
problem may be caused by Cache-Control from a server.

I believe the same/similar problem may affect other scenarios
where saving to disk is needed but not available (e.g. corrupted
installation, problems in IE cache store and so on).

Maxim D.