Current time: 04-25-2014, 05:36 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not able to enable browser caching of static assets
08-22-2011, 03:33 PM
Post: #1
not able to enable browser caching of static assets
Hi

I have enabled ExpiresOn in .htaccess in my server but still all images are showing expiry time as few minutes.

I am hosted on apache server
Find all posts by this user
Quote this message in a reply
08-23-2011, 06:40 AM
Post: #2
RE: not able to enable browser caching of static assets
Can you post the section of the .htaccess that deals with expiration times and a link to the test results? Just turning on expires isn't enough, you need to set a time (by mime type/whatever)
Visit this user's website Find all posts by this user
Quote this message in a reply
08-23-2011, 05:11 PM
Post: #3
RE: not able to enable browser caching of static assets
Hi

I have two platform on my site drupal and vbulletin. vbulletin forum is hosted on mysite.com/forum

We are further using rack space cloud for cdn and host images and css / jss files on cdn.

So structure is like this

mysite.com/forum - main website forum
rscdn.com - rackspace cdn
mysitestatic.com - cookiless domain

now with using cname
cdn.mysitestatic.com points to rscdn.com

and i replace ursl at my mainsite.com/forum with cdn.mysitestatic.com
++++++++++++++++++++
.htaccess at mysite.com
---------

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On

# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600

<FilesMatch \.php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
</FilesMatch>
</IfModule>

++++++++++++
.htaccess at mysitestatic.com
-----
# Speed up caching
FileETag MTime Size

ExpiresByType image/jpeg A1814400000
ExpiresByType image/gif A1814400000
ExpiresByType image/png A1814400000
ExpiresByType image/x-icon A1814400000
ExpiresByType text/plain A1814400000

# Good for one week
ExpiresByType application/x-javascript M604800
ExpiresByType text/css M604800
ExpiresByType text/html M604800


# Expires
ExpiresActive On
ExpiresDefault "access plus 366 days"

# Future Expires Headers
<filesmatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Sat, 27 Dec 2015 23:59:59 GMT"
</filesmatch>
Find all posts by this user
Quote this message in a reply
08-23-2011, 11:42 PM
Post: #4
RE: not able to enable browser caching of static assets
If you access the resources directly instead of through the CDN do you see the correct headers or also the shorter expiration? Some CDN's allow you to override the expires times and some will return the "remaining freshness" from when they last fetched the content so eliminating the CDN from the picture will help at least track down the issue.

As a sanity check, is apache configured to allow for .htaccess overrides on your static site? Otherwise the rules might be ignored entirely.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)