aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJPVenson <github@jpb.email>2025-06-04 16:07:33 +0000
committerJPVenson <github@jpb.email>2025-06-04 16:07:33 +0000
commit9ed9347cde3285fa3c5f9a9522ea95f66278f719 (patch)
tree9cf9f4c6c0b35dcb8c45ad1546fa4f4fde7c911f
parent916e897ed25f74b0112e51758e673f18ad13af1d (diff)
Add cache-control: no-cache to index.html if selfhosted
-rw-r--r--Jellyfin.Server/Startup.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Jellyfin.Server/Startup.cs b/Jellyfin.Server/Startup.cs
index 94ae54a35..aa8f6dd1c 100644
--- a/Jellyfin.Server/Startup.cs
+++ b/Jellyfin.Server/Startup.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
@@ -29,6 +30,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Primitives;
using Prometheus;
namespace Jellyfin.Server
@@ -195,7 +197,14 @@ namespace Jellyfin.Server
{
FileProvider = new PhysicalFileProvider(_serverConfigurationManager.ApplicationPaths.WebPath),
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();