Add host to handler logging

- Add the host to the Handler's logging fields, so you don't just see
the path, but also which domain was being requested.
This commit is contained in:
Gusted 2022-08-12 13:28:26 +02:00
parent 392c6ae452
commit c0e1e683fa
No known key found for this signature in database
GPG Key ID: FD821B732837125F

View File

@ -25,7 +25,7 @@ func Handler(mainDomainSuffix, rawDomain []byte,
dnsLookupCache, canonicalDomainCache, branchTimestampCache, fileResponseCache cache.SetGetKey,
) func(ctx *fasthttp.RequestCtx) {
return func(ctx *fasthttp.RequestCtx) {
log := log.With().Str("Handler", string(ctx.Request.Header.RequestURI())).Logger()
log := log.With().Strs("Handler", []string{string(ctx.Request.Host()), string(ctx.Request.Header.RequestURI())}).Logger()
ctx.Response.Header.Set("Server", "CodebergPages/"+version.Version)