Forum Moderators: not2easy

Message Too Old, No Replies

How to foil proxy css caching?

My isp sucks.

         

tolachi

12:38 pm on Jan 2, 2004 (gmt 0)

10+ Year Member



I am working on a site remotely but my isp is caching all .css pages. Is there any way to get opera, ie, or mozilla to use a page as a style sheet if it doesn't have the .css extension?

This would let me design the site using style.jkd (or anything else that doesn't get cached) as the style sheet and then switch over to a normal style sheet when the site went live.

I am using this php code to try to enforce non caching.

 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

Any suggestions for a solution to this problem are welcome.

TIA.

alexhudson

12:36 am on Jan 3, 2004 (gmt 0)

10+ Year Member



None of the browsers you mention care one fig about what the file is called. File extension is irrelevant; it doesn't tell you what is in the file. That's what the Content-type: header does.

So, as long as you set _that_ correctly (text/css, not text/html), they will be okay about it. IE generally ignores the content type, and sniffs the file. So, it would probably work already (have you actually tried this yet?)

Other thing to note: if your browser isn't sorting it out correctly, it may be that your webserver isn't setup correctly for If-Modified-Since, or that your timestamps are wrong.

tolachi

6:52 am on Jan 3, 2004 (gmt 0)

10+ Year Member



Thanks for the advice.

I modified my mime.type file so that the right header would be sent out and got non css extensions to be recognized as style shteets in mozilla.

However, I'm still having the same problem. I modify the file and nothing shows up as changed. I can even delete the css file and it still is accesable through my isp, and very quickly too. I'm pretty sure they must be caching it based on the content-type header.

The only thing I can think of is modifying mozilla to accept more than one conent type header as a css file. Does anyone know how to do that?

I believe I'm just going to have to develop this on my laptop.

jdMorgan

7:07 am on Jan 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



tolachi,

Can you set the server cache-control headers? It's fairly simple to do on Apache. All you need to do is to set Cache-control: "must-revalidate" on your CSS filetypes, and maybe set a shorter expires as well.

You could even set "no-cache" for the duration of your project if you don't want to hit shift-reload to see the new code.

Network, ISP, and browser caches generally do what they are told -- If the server tells them.

Jim

tolachi

8:33 am on Jan 3, 2004 (gmt 0)

10+ Year Member



Jim,

Thanks a lot, you set me on the right track.

I added

Header add Cache-Control "no-cache"

to my VirtualHost directory and there is no caching at all.

Also, ie would sniff css files with non standard file extensions. Unfortunately it didn't help the caching problem.

Pete