2
0

Add "Expires" Header to image responses

This commit is contained in:
Glax 2024-10-31 23:00:33 +01:00
parent 3f37eefe72
commit c7dc5e75f2

View File

@ -224,6 +224,7 @@ public partial class Server : GlobalBase, IDisposable
{ {
response.ContentType = image.Metadata.DecodedImageFormat?.DefaultMimeType ?? PngFormat.Instance.DefaultMimeType; response.ContentType = image.Metadata.DecodedImageFormat?.DefaultMimeType ?? PngFormat.Instance.DefaultMimeType;
response.AddHeader("Cache-Control", "public, max-age=3600"); response.AddHeader("Cache-Control", "public, max-age=3600");
response.AddHeader("Expires", $"{DateTime.Now.AddHours(1):ddd\\,\\ dd\\ MMM\\ yyyy\\ HH\\:mm\\:ss} GMT");
string lastModifiedStr = ""; string lastModifiedStr = "";
if (image.Metadata.IptcProfile is not null) if (image.Metadata.IptcProfile is not null)
{ {