Skip to content

Commit

Permalink
Set max-age for short-term AIA responses
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRand committed Aug 25, 2021
1 parent 50491ec commit 32cb194
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"math/big"
"net/http"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -523,6 +524,12 @@ func (s *Server) aiaHandler(w http.ResponseWriter, req *http.Request) {
return
}

// Set short-term caching duration of half the cert validity
maxAge := safetlsa.ValidityShortTerm() / 2
maxAgeSeconds := maxAge / time.Second
maxAgeStr := strconv.Itoa(maxAgeSeconds)
w.Header().Set("Cache-Control", "max-age=" + maxAgeStr)

for _, rr := range dnsResponse.Answer {
tlsa, ok := rr.(*dns.TLSA)
if !ok {
Expand Down

0 comments on commit 32cb194

Please sign in to comment.