This is a message.

In simple terms, how do I disable gzip for swf files? Created Jan 15, 2010

This thread is solved

Views: 6952     Replies: 7     Last reply Aug 6, 2011  
You must login first before you can use this feature

joshuwar

Posts: 2

Registered:
Jan 15, 2010

In simple terms, how do I disable gzip for swf files?

Posted: Jan 15, 2010

Hi. I've been experiencing the same black screen issues (solely in Firefox) described elsewhere on these forums, and the solution appears to be in tweaking gzip compression on the server.

I'm using Mamp, and by fiddling with httpd.conf in the conf directory for the last couple of hours, I've been able to achieve precisely nothing.

Can anybody tell me where in the file I'm supposed to add this line:

SetEnvIfNoCase Request_URI .swf$ no-gzip dont-vary

???

I've just been whacking it, and variations like this:


<Location />
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch MSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI 
.(?:gif|jpe?g|png|swf|pdf|exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
</Location>

at random into that file, restarting the server, and experiencing absolutely no change whatsoever.

Any tips would be excellent.

Thanks!

j

Edge
Vizmu Media ------------------- http://vizmu.com/

Posts: 576

Registered:
Nov 29, 2008

» In simple terms, how do I disable gzip for swf files?

Posted: Jan 15, 2010

Reply to: In simple terms, how do I disable gzip for swf files?, from joshuwar
Have you checked the swf after making the changes to apache to see if its still being gzipped?

To check it I use the firefox web developer extension. Just install n restart FF.
https://addons.mozilla.org/en-US/firefox/addon/60

After installed navigate to the page/swf file
http://releases.flowplayer.org/swf/flowplayer-3.1.5.swf
Just replace the url with the location of the flowplayer-3.1.5.swf on your server

Once viewing your http://your-domain.com/flowplayer-3.1.5.swf go up to the Tools menu in firefox then -> Web Developer -> Information -> View Response Headers.

Look for:
Content-Encoding: gzip

If there's any mention of gzip then apache is still gzipping that swf.
If there's no mention of gzip you're in the clear adn gzipping has already been disabled.

If gzipping has been disabled and you're still experiencing black screens on refreshes then check the response headers again for the Cache-Control setting. Telling the browser to cache the flowplayer-3.1.5.swf can often cause the same type of issues.

Again navigate to the flowplayer.swf then in FF Tools -> Web Developer -> Information -> View Response Headers.

Look for
Expires: Sun, 21 Dec 2012 06:07:09 GMT
Cache-Control: max-age=2592000

The time and max-age are just random numbers I added. If the Cache-Ccontrol says anything other than "Cache-Control: no-cache" then you should also look into disabling caching for swf's.

joshuwar

Posts: 2

Registered:
Jan 15, 2010

» » In simple terms, how do I disable gzip for swf files?

Posted: Jan 18, 2010

Reply to: » In simple terms, how do I disable gzip for swf files?, from edge
Hi Edge, thanks for getting back to me so quick, and simply.

I've done what you said, and unfortunately I don't see any mention of gzipping or Cache-Control.

Here are my response headers:

Date: Mon, 18 Jan 2010 11:50:18 GMT
Server: Apache/2.0.59 (Unix) PHP/5.2.5 DAV/2
Last-Modified: Sat, 24 Oct 2009 12:48:46 GMT
Etag: "6d3c5e-1b0aa-bfcac780"
Accept-Ranges: bytes
Content-Length: 110762
Content-Type: application/x-shockwave-flash


I then tried navigating to the file in Safari, just to see, and in Safari the player did actually appear (it didn't in FF). I don't know if this means anything?

If you've any other suggestions I'd be delighted to hear them.

Cheers,

J

Edge
Vizmu Media ------------------- http://vizmu.com/

Posts: 576

Registered:
Nov 29, 2008

» In simple terms, how do I disable gzip for swf files?

Posted: Jan 18, 2010

Reply to: In simple terms, how do I disable gzip for swf files?, from joshuwar
It looks like Gzipping is already off, or was successfully disabled for swf's. But you'll probably want to try adding the below snippet or something like it to tell browsers not to cache swf files. As several browsers will auto cache by default.

Even this method isn't 100% effective but in many cases it works great.

Try adding the below snippet to your .htaccess file.

<FilesMatch ".(swf)$">
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
</FilesMatch>

There's several ways to go about this depending on what modules are loading with your apache install. I found the above to work but I've only tested it in the latest version of apache running the default modules set and a default httpd.conf on centos5

You can also google the subject. There's tons of info around about it.
http://www.google.com/#hl=en&q=Cache-Control%3A+no-cache+httpd.conf&aq=f&aqi=&oq=&fp=e8d6ef47431c6a4a

Or
http://www.google.com/#hl=en&q=Cache-Control%3A+no-cache+htaccess&aq=&aqi=&oq=&fp=e8d6ef47431c6a4a

Cameron O'Rourke

Posts: 2

Registered:
Nov 4, 2009

Disabling cache: sledgehammer for fly?

Posted: Jan 18, 2010

Reply to: » In simple terms, how do I disable gzip for swf files?, from edge
I have a meta-question: is this not using a sledgehammer to swat a fly? I mean, do we really want to be disabling caching on our site for *all* swf files? If I'm loading a swf file on every page of my site (and I am) this will negatively impact my performance. I'll be grateful if it works, but its a little counter-intuitive as to why its relevant at all.

Any insights as to how/why this solves the timing or zero-size stage problem?

Edge
Vizmu Media ------------------- http://vizmu.com/

Posts: 576

Registered:
Nov 29, 2008

» Disabling cache: sledgehammer for fly?

Posted: Jan 18, 2010

Reply to: Disabling cache: sledgehammer for fly?, from corourke
Just make a .htaccess file in the directory that you store the swf files in you don't want cached. It will then only apply to that directory and any sub-directory's of it of it. The swf files elsewhere on the site will be cached normally if not in the "no cache" directory.

TJFO

Posts: 10

Registered:
Oct 5, 2010

» » Disabling cache: sledgehammer for fly?

Posted: Oct 7, 2010

Reply to: » Disabling cache: sledgehammer for fly?, from edge
Apache 2 i.e. needs this in a .htaccess (->swf-Folder with mp4):

SetEnv no-gzip dont-vary

Regards
Thomas