tobyweston / temperature-machine

Data logger for multiple DS18B20 temperature sensors on one or more machines
Apache License 2.0
67 stars 22 forks source link

Modify StaticResources Cache-Control header, to allow caching large files. #61

Closed matty256 closed 6 years ago

matty256 commented 6 years ago

To minimize clients downloading large static css/js files.

tobyweston commented 6 years ago

Shall we do compression whilst here? Should be straight forward but I don't have much experience as to whether its a good idea or not

tobyweston commented 6 years ago

This is great, I'm seeing load times reduce form ~10s to < 2s 👍

matty256 commented 6 years ago

Compression yes! If the request headers indicate the client supports gzip, we should compress the response, that will make a big difference to decrease initial page load time. Unfortunately I don't know scala/http4s and had no luck finding an example to follow.

tobyweston commented 6 years ago

No worries, I can have a go at that. Thanks for the PR!

tobyweston commented 6 years ago

Just thinking, shouldn't we use etags here?

tobyweston commented 6 years ago

Gzip added in #71

matty256 commented 6 years ago

Thanks Toby for adding Gzip!

When I worked on web projects 10 years ago, I targeted the simplest solution for the majority of browsers, i.e. simple cache control headers for static files. However, today all browsers should correctly support etags. If it only requires enabling a feature in the http server to generate and honor etags, I don't see why not. :)

Matt

-- Matt

On Tue, May 15, 2018 at 10:44 AM, Toby notifications@github.com wrote:

Gzip added in #71 https://github.com/tobyweston/temperature-machine/issues/71

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tobyweston/temperature-machine/pull/61#issuecomment-389234794, or mute the thread https://github.com/notifications/unsubscribe-auth/AjEUZRp-18cGAaXQR46ISehP4P_U9lV4ks5tywYFgaJpZM4SW7x8 .