You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// <summary>
/// When overridden in a derived class, returns a read-only stream to the virtual resource.
/// </summary>
/// <returns>
/// A read-only stream to the virtual file.
/// </returns>
public override Stream Open()
{
// Set the response headers here. It's a bit hacky.
if (HttpContext.Current != null)
{
HttpCachePolicy cache = HttpContext.Current.Response.Cache;
cache.SetCacheability(HttpCacheability.Public);
cache.VaryByHeaders["Accept-Encoding"] = true;
// Add Accept-Ranges header to fix videos not playing on Safari
HttpContext.Current.Response.AppendHeader("Accept-Ranges", "bytes");
IFileSystem azureBlobFileSystem = FileSystemProviderManager.Current.GetUnderlyingFileSystemProvider("media");
int maxDays = ((AzureBlobFileSystem)azureBlobFileSystem).FileSystem.MaxDays;
cache.SetExpires(DateTime.Now.ToUniversalTime().AddDays(maxDays));
cache.SetMaxAge(new TimeSpan(maxDays, 0, 0, 0));
cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
}
return this.stream();
}
This doesn't call
cache.SetETag(...);
cache.SetLastModified(..);
Last modified appears to already be available in AzureBlobFileSystem could be an easy upgrade. ETag would be a bonus!
Would help with CDN hosting of media files. Encountered the issue on Umbraco 7.15.1
The text was updated successfully, but these errors were encountered:
FileSystemVirtualFile has the following code:
This doesn't call
cache.SetETag(...);
cache.SetLastModified(..);
Last modified appears to already be available in AzureBlobFileSystem could be an easy upgrade. ETag would be a bonus!
Would help with CDN hosting of media files. Encountered the issue on Umbraco 7.15.1
The text was updated successfully, but these errors were encountered: