mirror of
https://github.com/C9Glax/tranga.git
synced 2025-01-12 11:27:32 +01:00
Add Cache-Control headers
This commit is contained in:
parent
6d723b6355
commit
1bd20791b8
@ -716,6 +716,7 @@ public class Server : GlobalBase
|
|||||||
if (content is not Stream)
|
if (content is not Stream)
|
||||||
{
|
{
|
||||||
response.ContentType = "application/json";
|
response.ContentType = "application/json";
|
||||||
|
response.AddHeader("Cache-Control", "no-store");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
response.OutputStream.Write(content is not null
|
response.OutputStream.Write(content is not null
|
||||||
@ -731,6 +732,7 @@ public class Server : GlobalBase
|
|||||||
else if(content is FileStream stream)
|
else if(content is FileStream stream)
|
||||||
{
|
{
|
||||||
string contentType = stream.Name.Split('.')[^1];
|
string contentType = stream.Name.Split('.')[^1];
|
||||||
|
response.AddHeader("Cache-Control", "max-age=600");
|
||||||
switch (contentType.ToLower())
|
switch (contentType.ToLower())
|
||||||
{
|
{
|
||||||
case "gif":
|
case "gif":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user