Embed Assets Theme

I’ve found a partial answer to my own question and wanted to share the insight:

The embed_[digest].css file is built using the active theme’s selected color palette.

The issue, as I’ve come to realize, is due to very aggressive HTTP response caching.

What I’m still hoping someone can answer is:
Where are the HTTP responses for asset files cached in Discourse?

This isn’t just browser-side caching — it appears to be server-side as well.


When tailing the Rails production log, I observe that only requests with a new, unseen set of query parameters trigger a fresh asset render:

$ tail -n 50 shared/standalone/log/rails/production.log -f
Started GET "/stylesheets/embed_afe162195ad0a7185309a19d8c36036d2e53708c.css?__ws=domain.tld&foo=bif" for fd00:aaaa::f1a at 2025-06-27 01:14:38 +0000
Processing by StylesheetsController#show as CSS
  Parameters: {"__ws"=>"domain.tld", "foo"=>"bif", "name"=>"embed_afe162195ad0a7185309a19d8c36036d2e53708c"}
Sent file /var/www/discourse/tmp/stylesheet-cache/embed_afe162195ad0a7185309a19d8c36036d2e53708c.css (0.2ms)
Completed 200 OK in 22ms

After that, any subsequent requests for the same URL (even with different query strings) return the same response — even if the underlying theme has changed.

For example:

  1. https://domain.tld/stylesheets/embed_[digest].css?__ws=domain.tld
  2. https://domain.tld/stylesheets/embed_[digest].css?__ws=domain.tld&foo=bar

I only see updated theme styles the first time a unique query is used. All future requests with the same parameters serve the previous version, even after recompilation.

The launcher script defaults to RAILS_ENV=production, and I’ve left that as-is. I could try switching to RAILS_ENV=development to disable caching entirely during development, but ideally, I’d like to know:

How can we clear or disable HTTP-level caching of asset responses in production?

If anyone has insight into how Discourse caches these asset responses — or how to properly invalidate them — that would be really helpful.