fix: add ETag header for bot/scraper page. For #4020
This commit is contained in:
parent
f59278764b
commit
a38c2d8ddf
@ -2,6 +2,7 @@ package handlers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/md5" // nolint:gosec
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@ -199,7 +200,7 @@ func handleScraperMetadataPage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Set a cache header
|
||||
middleware.SetCachingHeaders(w, r)
|
||||
|
||||
w.Header().Set("ETag", fmt.Sprintf("%x", md5.Sum(b.Bytes()))) // nolint:gosec
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
if _, err = w.Write(b.Bytes()); err != nil {
|
||||
log.Errorln(err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user