Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does FireFox 3.6.8 not cache static contents from asp.net developer server?

I am working on a asp.net web site, like normal user, we use asp.net developer server during coding and testing. Today, I found the firefox not cache any static file of my site, since our application is pretty big, it made page load time very slow. I checked firefox about:cache, all the static file cache setting looks like

           Key: http://localhost:26851/App_Layout/icons/actions/email/folder.png
     Data size: 871 bytes
   Fetch count: 1
 Last modified: 2010-08-19 11:59:46
       Expires: 1969-12-31 16:00:00

           Key: http://localhost:26851/Framework/ScriptLibrary/JQueryPlugins/ui.mouse.js
     Data size: 5079 bytes
   Fetch count: 1
 Last modified: 2010-08-19 11:59:39
       Expires: 1969-12-31 16:00:00

FireBug shows header like this

Server  ASP.NET Development Server/9.0.0.0
Date    Thu, 19 Aug 2010 22:10:27 GMT
X-AspNet-Version    2.0.50727
Cache-Control   public
Etag    "1CB3F32C834A880"
Content-Type    text/css
Content-Length  1775
Connection  Close

Firebug has another tab called "cache", the information is:

Last Modified   Thu Aug 19 2010 15:10:27 GMT-0700 (Pacific Daylight Time)
Last Fetched    Thu Aug 19 2010 15:10:27 GMT-0700 (Pacific Daylight Time)
Expires Wed Dec 31 1969 16:00:00 GMT-0800 (Pacific Standard Time)
Data Size   1775
Fetch Count 10
Device  disk

The expires date is set back to 1969-12-31, I believe that's the reason why they are loaded very time. I am using Visual studio 2008, windows 7 machine. The application works fine in IE, the contents are properly cached.

Did anybody see this behavior before?

like image 321
Russel Yang Avatar asked Aug 19 '10 22:08

Russel Yang


People also ask

How do I fix a static content cache?

Here is what you need to remember while caching static resources on CDN or local cache server: Use Cache-control HTTP directive to control who can cache the response, under which conditions, and for how long. Configure your server or application to send validation token Etag. Do not cache HTML in the browser.

What is static content caching?

While many forms of caching are available, static caching is a method for converting the page generated by a user's request into an HTML document to serve any subsequent requests to that same page.


1 Answers

You need to issue Expires header to make Firefox cache the files.

Otherwise, how do you think it could guess for how long does it need to cache the files?

like image 88
sanmai Avatar answered Sep 29 '22 11:09

sanmai