Closed
Description
Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9
10.0.1
Bug summary
Not sure if I am doing this wrong, but when I in Startup.cs use UseStaticFiles
it seems images isn't cropped or scaled.
app.UseStaticFiles(new StaticFileOptions
{
OnPrepareResponse = ctx =>
{
var headers = ctx.Context.Response.GetTypedHeaders();
headers.CacheControl = new CacheControlHeaderValue
{
Public = true,
MaxAge = TimeSpan.FromDays(365) // 1 year
};
headers.Expires = DateTime.UtcNow.AddYears(1);
}
});
app.UseRewriter(new RewriteOptions().AddIISUrlRewrite(env.ContentRootFileProvider, "IISUrlRewrite.xml"));
I tried switching the order of UseStaticFiles
and UseRewriter
, but didn't seem to make a difference.
Strange thing is that I also have this in a v9.4.1 without issues.
app.UseStaticFiles(new StaticFileOptions
{
OnPrepareResponse = ctx =>
{
var headers = ctx.Context.Response.GetTypedHeaders();
headers.CacheControl = new CacheControlHeaderValue
{
Public = true,
MaxAge = TimeSpan.FromDays(365) // 1 year
};
headers.Expires = DateTime.UtcNow.AddYears(1);
}
});
Specifics
No response
Steps to reproduce
Add app.UseStaticFiles()
to Startup.cs before app.UseUmbraco()
and notice that images in frontend is no longer cropped/scaled.
You may need to clear browser cache after this change to see the effect.
Expected result / actual result
Images to stay cropped.
Without UseStaticFiles()
:
With UseStaticFiles()
:
Metadata
Metadata
Assignees
Labels
No labels