Matthew
Matthew

Reputation: 15652

Understanding how images are served and cached

So I'm wondering how browsers treat requests for images. I'm hoping to use a cdn for serving product images on my website. I'd also like to use the cdn for serving button images and images used in my css.

The problem with this is that I don't have control over the expires headers (Rackspace files is what I'm looking into).

See, say I have a large image file as a background on my home page. So the page is accessed often, but the image stays the same. Is the browser going to request this image every time?

Or should I just use a cdn for my product images?

Upvotes: 0

Views: 341

Answers (2)

JoseMarmolejos
JoseMarmolejos

Reputation: 1770

caching is quite a broad subject. I suggest you start by reading about the different kinds of caching here http://www.mnot.net/cache_docs/#BROWSER and how caching works here http://www.web-caching.com/mnot_tutorial/how.html

Now, to answer your question: assuming the user has caching enabled and the cdn response headers are properly configured a user visiting your page multiple times will only request that background image once until the cache expires or those files are cleaned.

Upvotes: 1

SDReyes
SDReyes

Reputation: 9954

No, AFAIK you need necessarily to add the 'cache' header to your images to enable browser caching. This is a great tutorial about it.

Additionally you can read this article from Yahoo to get a very brief view of the topics.

Review specially these topics of the article:

  • Minimize HTTP Requests
  • Add an Expires or a Cache-Control Header
  • Use a Content Delivery Network

Hope it helps you

Upvotes: 0

Related Questions