Forum Moderators: phranque

Message Too Old, No Replies

mod deflate complete mystery.

mod_deflate .htaccess conflict

         

findlay70

7:29 pm on Oct 27, 2010 (gmt 0)

10+ Year Member



Hello,
I had been trying to gzip my JS components, so checked with my host (Hostgator, shared) - they said that mod_deflate wasn't enabled, so they turned it on. The components were zipped and nicely reduced by 60%+. Nice...... but.....

I found out that SOME of the videos on my website wouldnt play(f/fox) and none of the videos would play in SAFARI. Interestingly, if you REFRESHED the page, the video would load and play. I tested the path of the video and that worked, so it wasn't anything to do with the Amazon S3 service. Another interesting point is that friends in Asia could view all the videos in both f/fox and SAFARI, but myself in the US and friends in Europe still has the issue – all with same browser versions.

The server admin said it was something to do with .htaccess, so I played around with that and didnt get anywhere... currently in .htaccess.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ [mysite.com...] [L,R=301]
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

Today I asked my server admin to turn off mod_deflate and guess what.. the videos are back... so this mod was really causing a conflict with something. I wish I knew what it was as I have other scripts (expires headers) to add into .htaccess.

Now another strange thing – although the mod_deflate is now DISABLED, i'm still getting the components zipped - except the video on the current page which is NOT zipped (was before)...

Perhaps it was the mod_deflate, perhaps the video player conflict (flowplayer), perhaps it is .htaccess or perhaps it is Halloween around the corner that is causing this...

We are not ready to launch public yet, but can provide my url over direct mail to anyone who can assist shed some advice on what the issue may be. The server is running PHP 5.3.3.

Much appreciated
Andy

jdMorgan

8:42 pm on Oct 27, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should probably consider using a server headers checker to see what MIME-type the compressed files were being served with. The "Live HTTP Headers" add-on for Firefox and Mozilla-based browsers is one that I find handy.

Instead of asking your host to enable and disable mod_deflate, you could probably put a directive in your .htaccess file to disable and enable it as you wish while testing.

And speaking of testing, delete your browser cache before testing any configuration changes or new code on your server. Otherwise, your browser may well show you previously-cached stale versions of pages, objects, and server responses -- a likely cause of your still seeing compressed files after your host disabled mod_deflate.

Jim

findlay70

9:54 pm on Oct 27, 2010 (gmt 0)

10+ Year Member



Thanks Jim - you were absolutely right... i cleared the cache and I'm no longer getting zipped files... got excited for nothing...
Could you point me to a script that manages enable/diable mod-deflate. I'm assuming that in order for it to work it will need to be turned on at the server...?
Do you know what could be causing this problem and how does one troubleshoot this. I'd really like to have mod_deflate on, but not to mess around with user experience...
thanks again for taking the time to help
Andy

findlay70

3:15 pm on Oct 28, 2010 (gmt 0)

10+ Year Member



Dear Jim,
.htaccess has been recoded. If I check compression on [gidnetwork.com...] [seoconsultants.com...] and [whatsmyip.org...] i get confirmation that components are being zippped, but if I check ySlow, they are NOT...
could you take a peek at the below and advise why ySlow is not recognizing this and what changes I should/could make...
thanks very much/Andy

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>


<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>


# BEGIN COMPRESSION AND CACHING
<IfModule mod_deflate.c>
# Enable compression
AddOutputFilterByType DEFLATE text/css text/javascript application/x-javascript text/html text/plain text/xml image/x-icon
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_headers.c>
# Make sure proxies deliver correct content
Header append Vary User-Agent env=!dont-vary
# Ensure proxies deliver compressed content correctly
Header append Vary Accept-Encoding
</IfModule>
</IfModule>
<IfModule mod_headers.c>
# No ETags, No Pragma
Header unset Pragma
Header unset ETag
# Default cache time to 1 year (31536000 sec)
Header set Cache-Control "max-age=31536000, public, must-revalidate"
</IfModule>
# No ETags
FileETag none
# CACHE SETTINGS (mod_expires)
<IfModule mod_expires.c>
# Turn on Expires
ExpiresActive On
# set default to "access plus 1 year"
ExpiresDefault A31536000
# html - "modification plus 1 hour"
ExpiresByType text/html M3600
# css and JavaScript - "modification plus 6 weeks"
ExpiresByType text/css M3628800
ExpiresByType text/javascript M3628800
ExpiresByType application/x-javascript M3628800
</IfModule>
# No cache for php-files
<FilesMatch "\.(php)$">
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
<IfModule mod_headers.c>
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
</IfModule>
</FilesMatch>

jdMorgan

4:37 pm on Oct 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I didn't review all this code --too much for today-- but a quick scans clearly shows that the compression is qualified by user-agent strings. So my first question is "What user-agent string is used with Yslow requests?

Jim

findlay70

5:39 pm on Oct 28, 2010 (gmt 0)

10+ Year Member



Thanks Jim.
Sorry, cant answer that question... too technical for a noob like me..:)
I'll have to do some research.
Andy