Rocket
Rocket copied to clipboard
Caching a background image with the `Cache-Control` header
Sounds simple enough: return a NamedFile
from a handler whlist setting the Cache-Control
header to e.g. max-age=86400
. Still, I can't seem to figure this out no matter how much I look into the docs.
I'm using rocket
0.5.1 if that matters.
My questions:
- Is there no built-in way to "just do" this? Setting a caching policy for an image must be a common operation, especially for
FileServer
and alike. - Do I really need to implement a custom
Responder
whenever I need to add/change a response header? It's the closest I've actually gotten to solving this, but it never worked in the end since it neededasync
in order to respond from aNamedFile
.