Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Leverage browser caching ? Where do I add the dates?

Status
Not open for further replies.

burbon

Programmer
May 14, 2010
4
GB
Where and how do I set the expirey dates for images and other media, in order to enable leverage browser caching. I'm not sure if they go in my css file or in a file on the server somewhere. I am a designer/coder xhtml etc. so baby speak is appreciated. Thanks.
 
Hi

I do not understand your question.

For static content the web servers usually send the file's last modified date in the [tt]Date[/tt] HTTP response header and calculate a unique value for the [tt]ETAG[/tt] response header.

When next time the user agent requests such file, it sends back the received date in an [tt]If-Modified-Since[/tt] HTTP request header and/or the ETAG in an [tt]If-None-Match[/tt] request header.

If the web server finds out based on the date and/or the ETAG that the file was not modified on the server so the file in the user agent's cache is still usable, sends back 304 Not Modified
HTTP response code and no data.

If you want to ask the user agent to not reuse the cached files forever but to request a fresh copy even if the cached one seems to be correct, then you can configure the web browser to send an [tt]Expires[/tt] HTTP response header. See the documentation of mod_expires.

I hope something written above answered your question. If not, please give us details about your goal.


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top