APIs & Integrations

Not applicable

File Upload Overwrite Cache Issue

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 PDF Version 1.
  • View The PDF via the CDN URL (something like https://cdn2.hubspot.net/hubfs/<some_id>/pdf_1.pdf)
  • 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?

0 Upvotes
5 Replies 5
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

File Upload Overwrite Cache Issue

Hi @homerlex,

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).

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

File Upload Overwrite Cache Issue

Hi @homerlex,

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.

0 Upvotes
Not applicable

File Upload Overwrite Cache Issue

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.

0 Upvotes
Not applicable

File Upload Overwrite Cache Issue

Any thoughts on this one? Seems like the https://cdn2.hubspot.net/hubfs/ URL eventually clears the cache (hours?) but with the https://app.hubspot.com/file-preview URL I’m still seeing a verison of the attachment that is over a day old.

0 Upvotes
Not applicable

File Upload Overwrite Cache Issue

… and the other thing I noticed is possibly another level of caching going on at:

https://app.hubspot.com/file-preview/[some id]/file/[some id]/

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

0 Upvotes