Caching img src that causes redirect
Asked Answered
C

0

6

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.

Cleora answered 27/7, 2017 at 1:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.