I deployed my app (node.js) on AWS, with Cloudflare in front to apply CDN + domain + SSL. It works great, except when I need to update client-side JS. I redeploy source to AWS, rebuild using webpack, and restart the server.
Then I visit AWS url directly, the changes take effect as expected. When I visit same app via Cloudflare-linked domain, however, I’m seeing updates to HTML files take place but not the webpack JS I’ve rebuilt, which seems to be cached by something. I went to “Caching” in Cloudflare several times, purged all cache, confirmed that there was nothing left in Cloudflare by taking down the AWS and observing that I get 502 error on Cloudflare, as expected. When I bring AWS back up (with new webpack JS, and navigate to the app again via Cloudflare URL, I once again see the same stale webpack JS file being used, despite AWS url serving the new file and SSHed into AWS box showing no signs of stale webpack JS file anywhere.
I tried clearing Chrome cache and starting in Incognito mode as well, no effect. My current workaround is to keep prefixing the webpack JS file with numbers to force no-cache, which I don’t like. Based on above test, the cache problem does not seem to be on AWS side, but with something related to Cloudflare.