Building42 / Telegraph

Secure Web Server for iOS, tvOS and macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cache files when serving a directory

Joebayld opened this issue · comments

Would it be possible to add support to the serveDirectory function that would add cache headers based on when the files were last modified?

I've done some research on ETags but I can't seem to fully wrap my head around it.
I can work on it if someone can point me in the right direction. Thanks

Thanks, I've merged in the code, but I've removed the default cache header: 5c462be

I've also changed the responseForURL function to open so that it is easier to override, that way you can create your own HTTPFileHandler that overrides responseForURL, calls super and then sets the default cache header. Or you could handle adding that header in your route.

Please let me know if you have any questions or concerns.