The discussion revolves around serving static assets using cookie-free domains, prompted by a YSlow report suggesting this practice to reduce load times. P16 seeks a more efficient solution than setting up a storage bucket for static assets. Falco clarifies that the YSlow recommendation is outdated, as HTTP/2 eliminates the need for cookie-free domains due to multiplexing. P16 further asks about Discourse’s use of HTTP/2 features like multiplexing and server push. Falco confirms multiplexing is used, as it’s inherent to HTTP/2, but notes server push offers minimal performance gains and lacks cache awareness, making it less effective. codinghorror adds that using a CDN naturally provides a cookie-free domain, rendering the issue moot. Falco also mentions that while server push could improve performance, its benefits are limited and require advanced infrastructure like Fastly, Cloudflare, or Caddy, with further improvements potentially coming from RFC 8297, though it has seen little adoption.
When running a YSlow report, I get a suggestion to use cookie-free domains. It then lists the assets that are not cookie-free - which are mostly js and css. The cookies are adding to the page load time. I have the CDN set up (Google) along with SSL.
I could set up a storage bucket (under a subdomain) with all the static assets, but is there a more efficient/better way?
Well, yes. I don’t see a way to use HTTP/2 and not do that. It’s the most important feature of the protocol!
I did write a plugin and a change to core to enable this. As it’s not available in nginx, you need to add another thing in the stack, be it a CDN with push (Fastly, Cloudflare) or a more modern reverse proxy (Caddy, H20).
But my benchmarks showed a negligible difference in the page render time, and if you add the fact that is isn’t cache aware (only H20 has a workaround on that) it’s pretty bad.
I’m hopeful that with the RFC 8297 this will be better as you won’t wait for all middleware to do their thing before returning with the homework for the user agent, but that RFC didn’t get much attention so far.