News for hackers. Stuff that matters.
Re:Building a Shop with Sub-Second Page Loads: Lessons Learned by user5994461 on Sunday October 23, 2016 @03:41PM (#12775071)
> the browser should use the cached object without making any requests.

That's a common (mis)assumption, but that's not how it works in practise. Sorry ^^

I cannot comment on what was the intended behavior when HTTP caching and headers were first designed, a very long time ago.

It seems to me, that is was "request everytime + get 304 if not modified, thus save the file transfer time". That's how most implementations work in my experience.

Historically, transfer duration was way more problematic than latency. It's only recently that there are pages with hundreds of dependencies.

---

Rails and webservers: They MUST change the filename or the application will be fucked because of caching issues, mostly because of Firefox :D

Re:Building a Shop with Sub-Second Page Loads: Lessons Learned by DivineTraube on Sunday October 23, 2016 @03:44PM (#12775086)
All major browsers do respect the TTL if one is set. So it does save many requests. If it's not possible to the the TTL because the content might change at any time it is still useful to a caching header with a TTL of 0. Otherwise the browser will perform heuristic caching and compute a (often imprecise) estimation based on the last-modified header.
Re:Building a Shop with Sub-Second Page Loads: Lessons Learned by bzbarsky on Sunday October 23, 2016 @11:15PM (#12776610)
> but that's not how it works in practise

As someone who has actually worked on a browser's network stack, I can assure that it _is_ how it works in practice.