Home > Software engineering >  Files are still accessible after they've been deleted in Google Cloud Storage, or when a new fi
Files are still accessible after they've been deleted in Google Cloud Storage, or when a new fi

Time:04-06

I'm using Google Cloud Storage and asp.net core 6.

To configure the Google cloud storage I used this article: https://medium.com/net-core/using-google-cloud-storage-in-asp-net-core-74f9c5ee55f5

Uploading and deleting a file all work fine.

The only problem I'm experiencing is that when I delete a file, that file is still accessible. (when I look in the bucket I can see that the file is actually gone).

So I tried deleting it manually on the Google cloud platform, but I keep getting the same problem. The image is still visible with the link.

Even when I upload a new image with the same name as the old one, when displaying or downloading the image it's still the old image.

I tried with different browsers, in case it might have something to do with caching but that didn't help either.

I also checked object versioning was off.

I can also see that inside the bucket the 'created date' does in fact change.

CodePudding user response:

This sounds like the object is being stored in cache (either Google's cache, your browsers or potentially any proxy in-between).

Publicly shared objects default to being cacheable for 1 hour. After this, changes should be visible. If that is not acceptable to you set Cache-Control header/metadata to a shorter time or no-store.

  • Related