I've encountered an intermittent problem with my site. When visiting pages, the browser just downloads a .gz file instead of loading the page. Reloading the page a few times will eventually display the page correctly. The majority of the time, it occurs when visiting pages on the wiki (part of the site), but I've had it happen once on the main part of the site, too.
I'm using MediaWiki's file cache, but not the built-in gzip compression (it displays gibberish). I'm using mod_deflate (enabled according the host's instructions) and mod_pagespeed for the entire site. The tricky thing with this issue is that I can't accurately reproduce it. It pops up now and then, for apparently no reason.
My .htaccess:
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
AddType application/x-font-woff woff
AddDefaultCharset utf-8
# mod_deflate
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
<FilesMatch "\.(html|htm)$">
Header unset Etag
Header set Cache-control "max-age=0, no-cache"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|gif|png|js|css|woff|ttf|svg)$">
Header unset Etag
Header set Cache-control "public, max-age=604800"
</FilesMatch>
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters move_css_to_head
ModPagespeedEnableFilters remove_comments
</IfModule>
# Wiki ShortURLs
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [PT,L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]
The wiki cache settings are the following:
$wgMainCacheType = CACHE_ANYTHING;
$wgMemCachedServers = array();
$wgUseFileCache = true;
$wgFileCacheDirectory = "$IP/cache";
$wgShowIPinHeader = false;
$wgUseGzip = false;
The server is using PHP version 5.3.14 and all of the files on the non-wiki part of the site are .php files. Pages show a Content-Encoding of gzip. The site is hosted on GoDaddy and this issue has, so far, only appeared in Chrome (ver 22.0.1229.79 m), although I haven't extensively tested Firefox and IE for this problem yet.
There is almost no load on the site at the moment (just a handful of people testing). The only wiki extensions I have installed are: ConfirmEdit, Gadgets, ListRedLinks, Nuke, ParserFunctions, Renameuser, Vector, and WikiEditor. Everything else is stock.
So, my question is: what is causing this problem, why does it only show up at random, and how can I fix it?