Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted files are not properly removed from cache #229

Open
OwainJ opened this issue Oct 11, 2022 · 0 comments
Open

Deleted files are not properly removed from cache #229

OwainJ opened this issue Oct 11, 2022 · 0 comments

Comments

@OwainJ
Copy link

OwainJ commented Oct 11, 2022

Description
Media items deleted from the recycle bin are still served on initial requests on Chromium browsers, on Firefox the file is always served unless you use ctrl+F5, and on chrome on android 13 it is served on every request. Note, the file needs to be requested at least once before deletion for the issue to occour, so maybe there's some weird server side caching going on?
Restarting the web app fixes the issue.

Steps to reproduce:

  • Set up an Umbraco 8.18.5 installation with UmbracoFileSystemProviders.Azure 3.0.1 and deploy to an Azure web app with blob storage setup.
  • Add a media item with a file
  • Navigate to the file to ensure it works
  • Delete the media item and then delete it from the recycle bin
  • Check the blob storage to ensure that the file has been removed
  • Attempt to navigate to the file url again
    • incognito,
    • using a different browser
    • using a different device
  • Observe that the file will still be served on the first request
  • Restart the web app
  • Observe that the issue is now fixed

Demo with Umbraco 8.18.5 deployed to an Azure Web App (Windows B1):
Umbraco Blob Storage caching issue

I can reproduce this issue on 5 of my client's projects (running Umbraco 8.15.3, 8.15.4, and 8.15.5) and on a clean Umbraco 8.18.5 installation + UmbracoFileSystemProviders.Azure deployed to an Azure web app. But I cannot reproduce it when running locally.

Using the Diplo God Mode package, I tried clearing the Request Cache, Runtime Cache, Isolated Cache and the Partial Cache, but they had no effect on the issue.

Configs used in my demo (connection strings removed):

Web.config
<appSettings>
   ...
  <add key="AzureBlobFileSystem.ContainerName:media" value="cache-test-media" />
  <add key="AzureBlobFileSystem.RootUrl:media" value="https://[mystorage].blob.core.windows.net/" />
  <add key="AzureBlobFileSystem.ConnectionString:media" value="[connection string]" />
  <add key="AzureBlobFileSystem.MaxDays:media" value="365" />
  <add key="AzureBlobFileSystem.UseDefaultRoute:media" value="true" />
  <add key="AzureBlobFileSystem.UsePrivateContainer:media" value="true" />
</appSettings>
Media\Web.config
<?xml version="1.0"?>
<configuration>
<location path="Media">
  <system.webServer>
    <handlers>
      <remove name="StaticFileHandler" />
      <add name="StaticFileHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.StaticFileHandler" />
    </handlers>
  </system.webServer>
</location>
</configuration>
config\imageprocessor\cache.config
<?xml version="1.0" encoding="utf-8"?>
<caching currentCache="DiskCache">
<caches>
  <cache name="DiskCache" type="ImageProcessor.Web.Caching.DiskCache, ImageProcessor.Web" maxDays="365" memoryMaxMinutes="1" browserMaxDays="7">
    <settings>
      <setting key="VirtualCachePath" value="~/app_data/cache" />
    </settings>
  </cache>
</caches>
</caching>
config\imageprocessor\security.config
<?xml version="1.0" encoding="utf-8"?>
<security>
  <services>
  	<!--<service name="LocalFileImageService" type="ImageProcessor.Web.Services.LocalFileImageService, ImageProcessor.Web" />-->
  	<service prefix="media/" name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
  		<settings>
  			<setting key="Container" value="cache-test-media"/>
  			<setting key="MaxBytes" value="8194304"/>
  			<setting key="Timeout" value="30000"/>
  			<setting key="Host" value="https://[mystorage].blob.core.windows.net/"/>
  		</settings>
  	</service>
  	<service prefix="remote.axd" name="RemoteImageService" type="ImageProcessor.Web.Services.RemoteImageService, ImageProcessor.Web">
  		<settings>
  			<setting key="MaxBytes" value="4194304" />
  			<setting key="Timeout" value="3000" />
  			<setting key="Protocol" value="http" />
  		</settings>
  		<whitelist>
  			<!--<add url="https://[your Azure CDN].vo.msecnd.net/" />-->
  			<add url="https://[mystorage].blob.core.windows.net/" />
  			<add url="https://[mywebsite].azurewebsites.net/" />
  			<add url="http://localhost" />
  			<add url="http://127.0.0.1" />
  		</whitelist>
  	</service>
  </services>
</security>
@OwainJ OwainJ changed the title Deleted files are not properly removed from the Umbraco Memory Cache Deleted files are not properly removed from cache Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant