aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-07-11 15:35:23 -0500
committerGitHub <noreply@github.com>2026-07-11 15:35:23 -0500
commit30b14cd21f9f9c32a4505df6ba8d7537a77c518d (patch)
tree453047e8109b3127494373eb364a9f7d6b874291
parentca8c3ac7017bda6eac1f2ada62a67fa1b1863ac4 (diff)
parent3e9c800cbe1ada500a0092119c66ecafc136570f (diff)
downloadslskd-30b14cd21f9f9c32a4505df6ba8d7537a77c518d.tar.gz
Merge pull request #1786 from apkatsikas/fix/issue-1785-stale-index
fix: Set Cache-Control: no-cache on index.html responses
-rw-r--r--src/slskd/Program.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index 0fc6b294..5260760f 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -63,6 +63,7 @@ namespace slskd
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.FileProviders.Physical;
using Microsoft.IdentityModel.Tokens;
+ using Microsoft.Net.Http.Headers;
using Microsoft.OpenApi;
using Prometheus;
using Prometheus.DotNetRuntime;
@@ -1084,6 +1085,16 @@ namespace slskd
RequestPath = string.Empty,
EnableDirectoryBrowsing = false,
EnableDefaultFiles = true,
+ StaticFileOptions =
+ {
+ OnPrepareResponse = ctx =>
+ {
+ if (ctx.File.Name == "index.html" || ctx.File.Name == "default.html")
+ {
+ ctx.Context.Response.GetTypedHeaders().CacheControl = new CacheControlHeaderValue { NoCache = true };
+ }
+ },
+ },
};
if (!OptionsAtStartup.Headless)