I would like to have the browser cache the response from a redirect.
I am setting the src
attribute on an img
tag to a url that is a redirect to the final resource. The redirect is only good for a short period of time (e.g. 15 min) but the actual content downloaded is long lived (ie can safely be stored for a year). I am setting Cache-Control: max-age: <1 year>
on the image response however since the redirect can only be used for 15 minutes, I set Cache-Control: max-age: <15 minutes>
. How can I tell the browser to use the final response's cache settings and not even bother following the redirect on subsequent page views?
Does it matter what type of redirect (3XX
) that I use?
This is related to: Chrome and Safari caching 302 redirect however i actually want the behavior they see as a bug.