We are using the Files API to upload PDFs to attach to notes. Periodically we update the PDF and upload it again (with the overwrite flag set to true).
The upload/overwrite works fine but it seems the original PDF is cached on CDN for some period of time. I tested by:
Upload the modified PDF (with the same name as the original)
View the PDF at https://cdn2.hubspot.net/hubfs/<some_id>/pdf_1.pdf again and it has not changed (even with browser cache cleared or even viewing it from another browser).
View the PDF with some random junk on the query_string: https://cdn2.hubspot.net/hubfs/<some_id>/pdf_1.pdf?1111 and I now see the new version of the PDF
How long will the file be cached? Is there anyway to invalidate the cache when we upload a new version of the file?
While I didn’t hear back regarding that specific domain’s caching, it’s entirely possible that the team made changes. If you run into the same issue going forward, feel free to reach back out on this topic (or create a new one).
While file replacement should happen relatively quickly, it may take up to a couple of hours for the cache to clear entirely (see below). I’m unsure what the behavior of the app.hubspot.com/file-preview caching is; I’ll need to touch base with product on that.
Did something change recently? I don’t have the caching issue anymore. After I upload the new version of the file I can see it properly in the file-preview now.
I attached the recently updated file to a note, click on the attachment and am brought to the URL above. The version of the attachment I see there is even older that the one I see at https://cdn2.hubspot.net/hubfs/<some_id>/pdf_1.pdf