4

I've run a couple tests and cannot get either a 301 or 302 redirect to be cached. In my case I have a large number of avatar icons on a page which I want redirected to a gravatar and/or facebook icon and I want the redirect to be cached, preferably for a medium period say a week.

Example header:


HTTP/1.1 301 Moved Permanently
Date: Sat, 27 Nov 2010 12:13:04 GMT
Server: Apache/2.2.3 (Red Hat)
Location: http://www.gravatar.com/avatar/552e3422df95ab611ce0d8d5b5d66c67?s=50&d=identicon
Cache-Control: max-age=414000
Expires: Thu, 02 Dec 2010 07:13:04 GMT
Content-Length: 330
Content-Type: text/html; charset=iso-8859-1

So is this possible and if so what am I doing wrong?

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
Brendan Heywood
  • 981
  • 1
  • 8
  • 16

1 Answers1

0

I understand you intention, but I doubt that browsers are caching 301 status responses (which is confirmed here). Reading your answer you have the HTML-content under your control. Why don't you just change the image-links inside your HTML-response? So instead working with 301 you already "migrate" the links inside the source-document and browser directly hits a 200 link.

Community
  • 1
  • 1
manuel aldana
  • 15,650
  • 9
  • 43
  • 50