From a339574f058f1a924becf5fe2c1bb2f796382702 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Fri, 30 Jan 2026 22:02:35 -0500 Subject: [PATCH] fix: forward caching headers for client-side caching Jellyfin sends ETag, Last-Modified, and Cache-Control headers that allow clients like Feishin to cache songs locally. Proxy now forwards these headers so clients don't re-download songs unnecessarily. --- allstarr/Controllers/JellyfinController.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/allstarr/Controllers/JellyfinController.cs b/allstarr/Controllers/JellyfinController.cs index b45b055..5d7cecf 100644 --- a/allstarr/Controllers/JellyfinController.cs +++ b/allstarr/Controllers/JellyfinController.cs @@ -778,6 +778,23 @@ public class JellyfinController : ControllerBase var contentType = response.Content.Headers.ContentType?.ToString() ?? "audio/mpeg"; + // Forward caching headers for client-side caching + if (response.Headers.ETag != null) + { + Response.Headers["ETag"] = response.Headers.ETag.ToString(); + } + + if (response.Content.Headers.LastModified.HasValue) + { + Response.Headers["Last-Modified"] = response.Content.Headers.LastModified.Value.ToString("R"); + } + + if (response.Headers.CacheControl != null) + { + Response.Headers["Cache-Control"] = response.Headers.CacheControl.ToString(); + } + + // Forward range headers for seeking if (response.Content.Headers.ContentRange != null) { Response.Headers["Content-Range"] = response.Content.Headers.ContentRange.ToString();