Still need cache-busting on CSS file? #27657
-
I read this but still am having trouble: According to that issue and @SteveSandersonMS , I don't need cache-busting URLs, as Blazor will automatically request a fresh one as needed. Yet when I deploy my site and open it in Firefox, I get the old styles and see in Firefox developer tools network tab that app.min.css is retrieved from disk cache. I have to press Ctrl+F5 to get the new styles. So what is going wrong in this chain? It seems to me that I still need cache-busting URL for my CSS on each deployment. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
Cross-posted here: https://stackoverflow.com/questions/64760377/still-need-cache-busting-on-css-file-in-blazor-webassembly-site |
Beta Was this translation helpful? Give feedback.
-
Whether or not the browser uses cached copies is controlled by the HTTP headers sent by your server when it returned the |
Beta Was this translation helpful? Give feedback.
-
No, Blazor is not involved in serving the static content (CSS files in |
Beta Was this translation helpful? Give feedback.
Whether or not the browser uses cached copies is controlled by the HTTP headers sent by your server when it returned the
.css
file previously. As long as it has a validetag
then the browser should check for updates via a request withan If-Modified-Since
header. This isn't something that Blazor WebAssembly controls, since Blazor WebAssembly is purely client-side and hence doesn't control the headers sent by your server.