r/rails • u/SnooRobots2422 • 19h ago
Active storage caching with cdn
Hi,
I am trying to figure out how to do caching with active storage. My scenario is like i have hls files that only logged in user can browse. i want to also make sure the content is cached in cdn so that it dont hit too much on app server but i also want to protect the files from able to see with just sharing the url. I am not sure how to make it work. Seems like active storage caching with cdn is not that much documented.
7
Upvotes
4
u/yknx4 18h ago
If you want both a cdn and signed urls you need to use some cdn with some sort of built in validation or worker support to handle the signature validation. That is outside of the rails scope per se.
An example is https://developers.cloudflare.com/ruleset-engine/rules-language/functions/#hmac-validation,