3 months ago
Hi everyone — hoping to get some guidance from the community on a production caching issue we’re seeing on Railway.
We’re running an app hosted entirely on Railway. One developer pushes changes and sees updates immediately after a deploy completes. However, other viewers (including myself and potentially end users) don’t always see the latest frontend changes unless they clear their browser cache or open the site in an incognito window.
This is concerning because it suggests users may not reliably receive new features or bug fixes after deploys.
Here’s what we’ve observed:
Static assets are served directly via Railway (no external CDN)
The issue primarily affects frontend UI changes (HTML templates, CSS, JS)
We deploy directly to production from the main branch
A hard refresh (Cmd + Shift + R) does not always fix it
Incognito mode usually shows the updated version immediately
We are not intentionally setting custom cache headers, but are unsure what defaults may be applied
It feels like one of the following:
aggressive caching of static assets
missing cache invalidation on deploy
lack of cache-busting (e.g., unversioned static filenames)
Questions for the community:
Does Railway apply any default caching behavior for static assets?
How are static files invalidated on redeploy?
Are there best practices to ensure frontend updates always propagate to users immediately?
Anything specific to watch out for when serving static assets directly from Railway?
Any insight or pointers would be greatly appreciated. Happy to share more technical details if helpful.
Thanks in advance!
2 Replies
3 months ago
I recently started using a custom Caddyfile to get around this. See attached file. Note the Cache-Control header additions.
Attachments
Status changed to Awaiting User Response Railway • 3 months ago
Status changed to Closed itsrems • 3 months ago