473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Gzip and caching

Unicron
Hi folks, I couldn't find any posts about this issue-

I am using Firebug to examine my page loading. When I call a large JS file, it gets downloaded once and then shows as being cached the next time I go to the page.

For example, it shows "9 requests 100 KB (90 KB from cache)"

However, if I change the JS file to a PHP file with GZIP, it compresses that 90KB file down to 20KB, but never says it pulls it from cache. The Firefox "about:cache" page shows that each time the page loads, the fetch count on that file goes up.

I am wondering- is this gzipped file being repeatedly downloaded, or just checking that the file is still the same? If it is being downloaded again, is there a different header I can send to make it work?

Here is the PHP I am using for the gzipped javascript (see to expire 1 year)

[PHP]
ob_start("ob_gzhandler");
header("Content-type: text/javascript; charset: UTF-8");
header("Content-Encoding: gzip");
header("Cache-Control: must-revalidate");
header("Expires: ".gmdate("D,d M Y H:i:s",time() + 3600*24*365)." GMT");
[/PHP]

Thanks everyone!
Oct 2 '08 #1
1 1495
pbmods
5,821 Expert 4TB
Heya, Unicron.

I'm not terribly familiar with how browser cache headers work, but this article might be useful:

http://www.mnot.net/cache_docs/
Oct 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: bmgz | last post by:
I am having problems trying to use the gzip module, I do the followig >>>import gzip >>>file = gzip.GzipFile("testfile.txt") >>>file.write() -which params does this accept?, archive name? I...
10
by: Xah Lee | last post by:
today i need to use Python to decompress gzip files. since i'm familiar with Python doc and have 10 years of computing experience with 4 years in unix admin and perl, i have quickly located the...
1
by: Martin | last post by:
By trial and error, I've become convinced that CSS is unsafe in IE6 when the webserver supports GZip-encoding. There's an intermittent bug that screws up one page draw every 20 or 30 requests. ...
2
by: comp.lang.php | last post by:
I am simply trying to zip together selected files into a single ZIP file. Windows XP doesn't have a native process by which you can do this, so I borrowed gzip, downloaded and installed, and upon...
25
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official Python tutorial 8 months ago, have spent 30...
14
by: Bill | last post by:
I've written a small program that, in part, reads in a file and parses it. Sometimes, the file is gzipped. The code that I use to get the file object is like so: if filename.endswith(".gz"):...
4
by: Aidan | last post by:
Hi, I'm having a bit of trouble with a python script I wrote, though I'm not sure if it's related directly to python, or one of the other software packages... The situation is that I'm trying...
0
by: Gabriel Genellina | last post by:
En Wed, 19 Nov 2008 13:25:03 -0200, Barak, Ron <Ron.Barak@lsi.com> escribió: Note *where* the exception is raised. Until something is actually read, no check is made for the file format. --...
0
by: Barak, Ron | last post by:
Thanks Gabriel, Okay, I get it: I was under the impression that the format check would be done on the open. Bye, Ron. -----Original Message----- From: Gabriel Genellina Sent: Thursday,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.