mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
Added cache headers to static resources.
This commit is contained in:
parent
e21a0bd231
commit
b56da336c0
5 changed files with 73 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Nancy;
|
||||
using Nancy.Responses;
|
||||
|
@ -33,5 +34,24 @@ namespace NzbDrone.Api.Extensions
|
|||
{
|
||||
return new JsonResponse<TModel>(model, NancySerializer) { StatusCode = statusCode };
|
||||
}
|
||||
|
||||
public static IDictionary<string, string> DisableCache(this IDictionary<string, string> headers)
|
||||
{
|
||||
headers.Add("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
headers.Add("Pragma", "no-cache");
|
||||
headers.Add("Expires", "0");
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
public static IDictionary<string, string> EnableCache(this IDictionary<string, string> headers)
|
||||
{
|
||||
headers.Add("Cache-Control", "max-age=31536000 , public");
|
||||
headers.Add("Expires", "Sat, 29 Jun 2020 00:00:00 GMT");
|
||||
headers.Add("Last-Modified", "Sat, 29 Jun 2000 00:00:00 GMT");
|
||||
headers.Add("Age", "193266");
|
||||
|
||||
return headers;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue