2 of 2
2
Allow browsers to cache CSS and JavaScript
Posted: 21 August 2008 11:29 PM   [ Ignore ]   [ # 19 ]  
Grad Student
Rank
Total Posts:  36
Joined  04-19-2008

I’d like to bump this one. Have just started using EE and had wondered why our site loads so much slower than it was with static HTML files.

Worked this out to be the non-cache of CSS/JS files. Have used the tag above for CSS which has helped but really need to be able to return something like 304 instead of 200 to show the browser is using its own cache.

Has there been anything more in this?

Thanks

Profile
 
 
Posted: 21 August 2008 11:33 PM   [ Ignore ]   [ # 20 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15825
Joined  06-03-2002

Is your PHP environment running under CGI or as an Apache module?  Under CGI, Apache has a bug that prevents us from being able to accomplish this from PHP.

 Signature 
Profile
MSG
 
 
Posted: 21 August 2008 11:47 PM   [ Ignore ]   [ # 21 ]  
Grad Student
Rank
Total Posts:  36
Joined  04-19-2008

Hi Derek.

FastCGI. That’s annoying wink Reason we moved over to FastCGI is to have better security over an Apache module but whilst retaining some of the performance.

So, I guess my options are;

A) Use static files outside of EE
B) Switch back to PHP as a module?

M

Profile
 
 
Posted: 21 August 2008 11:53 PM   [ Ignore ]   [ # 22 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15825
Joined  06-03-2002

PHP as an Apache module is perfectly secure if run properly (e.g. Apache running as each user instead of apache/www/nobody).  Many hosts that cater to dynamic sites such as our partner EngineHosting run this way.  If an environment is relying solely on FastCGI for security between accounts, I’d be wary.  What if other users on your server opted to not do so?

At any rate though, you are correct, this feature should work for you if you switch back to running as a module, and keeping those resources outside of ExpressionEngine is certainly an option, though less convenient.

 Signature 
Profile
MSG
 
 
Posted: 21 August 2008 11:55 PM   [ Ignore ]   [ # 23 ]  
Grad Student
Rank
Total Posts:  36
Joined  04-19-2008

Thanks for that. It’s only an internal box so we only have OUR sites on it.

Can you just confirm, that if/when we switch back to Module based PHP - will we have to make any further changes to get the JS files to cache?

Profile
 
 
Posted: 21 August 2008 11:56 PM   [ Ignore ]   [ # 24 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15825
Joined  06-03-2002

Ah, well then go for it!  Only CSS templates at this time support this feature, called via the {stylesheet=} variable.  Unfortunately your JS will still not benefit at this time.

 Signature 
Profile
MSG
 
 
Posted: 22 August 2008 12:05 AM   [ Ignore ]   [ # 25 ]  
Grad Student
Rank
Total Posts:  36
Joined  04-19-2008

Ah OK. I will stay put for now. The CSS files do cache under FastCGI currently so that is cool and I will just make the rest be static files.

If (and when this changes) will it be in the changelog?

Profile
 
 
Posted: 22 August 2008 08:00 AM   [ Ignore ]   [ # 26 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15825
Joined  06-03-2002

Yes if we do find a way to work around this (and add that feature to JS) it will have a public change log note.

 Signature 
Profile
MSG
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64892 Total Logged-in Users: 65
Total Topics: 81821 Total Anonymous Users: 36
Total Replies: 439893 Total Guests: 275
Total Posts: 521714    
Members ( View Memberlist )