I'm building a large custom backoffice section but when making changing keep running into caching issues. Using umbraco 9.5
Whilst building its easy to just have the developer tools open and there are no issues. However when changes are published and other people test they often get older cached versions of the templates. Then then have to open developer tools with caching disabled and refresh ... that works but its not practical once real users are using it and a chance needs to be made.
I've tries to solve it by changing the runtime minification settings - that kinds of works but seems inconsistent, some pages get new versions and other don't.
This solution seems to work. Manually setting the response headers for any file in the directory /app_plugins/. Obviously best to remove once all backend development complete but when a backend is still developing as people using it is seems to do the job. Could be changed to apply to a specific plugin directory. Hope it helps someone.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseStaticFiles(new StaticFileOptions()
{
OnPrepareResponse = (ctx) =>
{
if (ctx.File.PhysicalPath.Contains(@"\App_Plugins\"))
{
var headers = ctx.Context.Response.GetTypedHeaders();
headers.CacheControl = new Microsoft.Net.Http.Headers.CacheControlHeaderValue
{
Public = true,
MaxAge = TimeSpan.FromSeconds(0)
};
}
}
});
Custom backoffice section caching templates
I'm building a large custom backoffice section but when making changing keep running into caching issues. Using umbraco 9.5
Whilst building its easy to just have the developer tools open and there are no issues. However when changes are published and other people test they often get older cached versions of the templates. Then then have to open developer tools with caching disabled and refresh ... that works but its not practical once real users are using it and a chance needs to be made.
I've tries to solve it by changing the runtime minification settings - that kinds of works but seems inconsistent, some pages get new versions and other don't.
Has anyone got any tips on ensuring latest backoffice pages are rendered when changes are made? Thanks
Possibly found the solution - need to check it works for testers. Setting cachebuster to AppDomain and recycling the process seems to do it.
Still seems inconsistent ...
This solution seems to work. Manually setting the response headers for any file in the directory /app_plugins/. Obviously best to remove once all backend development complete but when a backend is still developing as people using it is seems to do the job. Could be changed to apply to a specific plugin directory. Hope it helps someone.
}
is working on a reply...