Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control caching for static content

Tags:

yesod

I am looking for something like cacheSeconds for the subsite generated by Yesod.Static in order to control caching of static resources. Is it possible?

like image 688
Roman Cheplyaka Avatar asked Jun 04 '26 15:06

Roman Cheplyaka


1 Answers

Yes. Yesod.Static is just a Yesod wrapper around wai-app-static, which is a general purpose WAI static file server. You want to set the ssMaxAge setting. Depending on exactly what your code looks like now, this could be something along the lines of:

Static settings <- static "/some/static/path"
let newStatic = Static $ settings { ssMaxAge = NoMaxAge }
like image 90
Michael Snoyman Avatar answered Jun 07 '26 05:06

Michael Snoyman