Lower Cache-Control values

This commit is contained in:
Daniele Tonon
2023-08-04 15:56:10 +02:00
parent 2fcf17aa1d
commit 6a1ac7a302
3 changed files with 5 additions and 3 deletions

View File

@@ -320,7 +320,9 @@ func render(w http.ResponseWriter, r *http.Request) {
templateMapping[typ] = "other.html" templateMapping[typ] = "other.html"
} }
if (strings.Contains(typ, "profile") && len(renderableLastNotes) != 0) || (!strings.Contains(typ, "profile") && len(content) != 0) { if strings.Contains(typ, "profile") && len(renderableLastNotes) != 0 {
w.Header().Set("Cache-Control", "max-age=3600")
} else if !strings.Contains(typ, "profile") && len(content) != 0 {
w.Header().Set("Cache-Control", "max-age=604800") w.Header().Set("Cache-Control", "max-age=604800")
} else { } else {
w.Header().Set("Cache-Control", "max-age=60") w.Header().Set("Cache-Control", "max-age=60")

View File

@@ -65,7 +65,7 @@ func renderArchive(w http.ResponseWriter, r *http.Request) {
} }
if len(data) != 0 { if len(data) != 0 {
w.Header().Set("Cache-Control", "max-age=86400") w.Header().Set("Cache-Control", "max-age=3600")
} else { } else {
w.Header().Set("Cache-Control", "max-age=60") w.Header().Set("Cache-Control", "max-age=60")
} }

View File

@@ -73,7 +73,7 @@ func renderRelayPage(w http.ResponseWriter, r *http.Request) {
} }
if len(renderableLastNotes) != 0 { if len(renderableLastNotes) != 0 {
w.Header().Set("Cache-Control", "max-age=604800") w.Header().Set("Cache-Control", "max-age=3600")
} else { } else {
w.Header().Set("Cache-Control", "max-age=60") w.Header().Set("Cache-Control", "max-age=60")
} }