mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Add cache-control: no-cache to index.html if selfhosted
This commit is contained in:
parent
916e897ed2
commit
9ed9347cde
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
@ -29,6 +30,7 @@ using Microsoft.Extensions.Configuration;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.FileProviders;
|
using Microsoft.Extensions.FileProviders;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Primitives;
|
||||||
using Prometheus;
|
using Prometheus;
|
||||||
|
|
||||||
namespace Jellyfin.Server
|
namespace Jellyfin.Server
|
||||||
@ -195,7 +197,14 @@ namespace Jellyfin.Server
|
|||||||
{
|
{
|
||||||
FileProvider = new PhysicalFileProvider(_serverConfigurationManager.ApplicationPaths.WebPath),
|
FileProvider = new PhysicalFileProvider(_serverConfigurationManager.ApplicationPaths.WebPath),
|
||||||
RequestPath = "/web",
|
RequestPath = "/web",
|
||||||
ContentTypeProvider = extensionProvider
|
ContentTypeProvider = extensionProvider,
|
||||||
|
OnPrepareResponse = (context) =>
|
||||||
|
{
|
||||||
|
if (Path.GetFileName(context.File.Name).Equals("index.html", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
context.Context.Response.Headers.CacheControl = new StringValues("no-cache");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mainApp.UseRobotsRedirection();
|
mainApp.UseRobotsRedirection();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user