If gzip is enabled IE tries to download some file when anonimous user tries to open homepage starting with www.

"www.site.com" couses the problem and with "site.com" everything is ok.

FF and Opera opens both types without any problems.

I disabled gzip for now, but would like to use this option. Would be thankful for any suggestions.

Comments

mikeytown2’s picture

Enable 301 redirect to www site in your htaccess file

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

The last 2 lines need to be uncommented in the htaccess file. Replace example and com with your site name.

  RewriteCond %{HTTP_HOST} ^drupal\.org$ [NC]
  RewriteRule ^(.*)$ http://www.drupal.org/$1 [L,R=301]

OR

try this for your boost rules... ps what's the date for boost? below is for the latest dev.

  ### BOOST START ###
  <FilesMatch "(\.html\.gz|\.html)$">
    <IfModule mod_headers.c>
      Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
      Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
    </IfModule>
  </FilesMatch>
  <IfModule mod_mime.c>
    AddCharset utf-8 \.html
    AddCharset utf-8 \.xml
  </IfModule>
  AddEncoding x-gzip \.gz
  <FilesMatch "\.html\.gz$">
    ForceType text/html
  </FilesMatch>
  <FilesMatch "\.xml\.gz$">
    ForceType text/xml
  </FilesMatch>

  # Skip boost IF not get request OR uri has wrong dir OR cookie is set
  RewriteCond %{REQUEST_METHOD} !^GET$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|themes))|(/(comment/reply|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID
  RewriteRule .* - [S=4]

  # GZIP
  RewriteCond %{HTTP:Accept-encoding} gzip
  RewriteCond %{DOCUMENT_ROOT}/cache/gz/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
  RewriteRule .* cache/gz/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html]
  RewriteCond %{DOCUMENT_ROOT}/cache/gz/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz -s
  RewriteRule .* cache/gz/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz [L,T=text/xml]

  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s
  RewriteRule .* cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=text/xml]
  ### BOOST END ###

key part is [L,T=text/html]

EDIT: Updated this code block. its in the latest dev (june 13th) with these changes.

mikeytown2’s picture

Title: IE tries to download a file instead of openning a page with gzip » IE tries to download a file instead of opening a page with gzip
Component: Miscellaneous » Apache integration

what's your apache version? I've noticed some differences between apache versions in regards to this issue. Sadly an older version of apache worked correctly and it was the newer version that screwed up.

ps changed the above boost htaccess code.

Gus24’s picture

Status: Active » Closed (fixed)

[L,T=text/html] - makes IE not to download the file but actually open this .gz file in bowser. Not readable of course. I don't know where to see my apache version.

I switched to the last dev and didn't find gzipping at all. So I rolled back to the earlier dev and turned gzip off. I'm quite satisfied with the performance even without gzip. So I maybe close this issue. Thanks for your assistance anyway!

mikeytown2’s picture

Status: Closed (fixed) » Active

If it opens the file in the browser then AddEncoding x-gzip \.gz is not getting set correctly for some reason. Can you check that it's in your htaccess file? You can check your php version by running this in a php code block.

  echo $_SERVER['SERVER_SOFTWARE'];

Should output something like Apache/2.2.11 DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9

Latest dev, gzip is controlled by the Page compression setting. Click Disable to disable boost's gzip.

mikeytown2’s picture

Status: Active » Postponed (maintainer needs more info)

Please provide feedback

mikeytown2’s picture

Status: Postponed (maintainer needs more info) » Fixed
AddEncoding x-gzip \.gz

changed to

AddEncoding x-gzip .gz

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sdrycroft’s picture

Status: Closed (fixed) » Active

I was having similar issues to the above, and found that changing

AddEncoding x-gzip .gz

to

AddEncoding gzip .gz

fixed the issue for me. This may well be an issue that crops up again.

mikeytown2’s picture

@sdrycroft
What version of apache are you running? what version of IE did you test it on?

http://httpd.apache.org/docs/trunk/mod/mod_mime.html#addencoding

To make this long story short, you should always use x-gzip and x-compress for these two specific encodings.

mikeytown2’s picture

Status: Active » Postponed (maintainer needs more info)
sdrycroft’s picture

Apache 2.2 (RHEL5), and IE8.

Headers [working]

GET / HTTP/1.1
Accept: */*
Accept-Language: en-gb
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Accept-Encoding: gzip, deflate
Host: example.com
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ********


HTTP/1.1 200 OK
Date: Wed, 12 Aug 2009 09:40:57 GMT
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Thu, 30 Jul 2009 13:05:59 GMT
ETag: "310357-13ca-46febf702dbc0"
Accept-Ranges: bytes
Content-Length: 5066
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Keep-Alive: timeout=3, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip

Headers [Broken]

GET / HTTP/1.1
Accept: */*
Accept-Language: en-gb
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Accept-Encoding: gzip, deflate
Host: example.com
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ********


HTTP/1.1 200 OK
Date: Wed, 12 Aug 2009 09:45:55 GMT
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Thu, 30 Jul 2009 13:05:59 GMT
ETag: "310357-13ca-46febf702dbc0"
Accept-Ranges: bytes
Content-Length: 5066
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Keep-Alive: timeout=3, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Content-Encoding: x-gzip
mikeytown2’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

That version of apache is messed up for some reason. It's supposed to return gzip even though it's set to x-gzip. Just confirmed via wireshark & IE8 with apache 1.3 (shared hosting) & 2.2.3 (Red Hat).

Here's the headers I get using IE8 & the default boost settings.

GET / HTTP/1.1
Accept: */*
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Accept-Encoding: gzip, deflate
Host: ***
Connection: Keep-Alive
Cache-Control: no-cache

HTTP/1.1 200 OK
Date: Wed, 12 Aug 2009 19:18:40 GMT
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Wed, 12 Aug 2009 19:17:26 GMT
ETag: "bf9d48-16a8-ab5b5d80"
Accept-Ranges: bytes
Content-Length: 5800
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip

Bug your host, they messed up somewhere.

mikeytown2’s picture

Status: Closed (fixed) » Active

I will say this though, if using this trick then you have to set it to gzip
#528506: Better Detect GZIP Compression

It could also be an issue with a firewall, as those have been known to mess up content-encoding headers... going to switch this back to active, as I don't know of any browsers the send x-gzip. So I believe the current recommendation on the apache site is now outdated.

mikeytown2’s picture

sdrycroft’s picture

Thanks for your time mikeytown2. I'll look into this further at some point (I'm the host, so I'll have to bug myself).