Skip to content

Commit

Permalink
Add headers to the to be logged request.
Browse files Browse the repository at this point in the history
  • Loading branch information
jum committed May 13, 2024
1 parent d2cbbaa commit cb70e7f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ngcplogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ func (l *nGCPLogger) extractCaddyFromPayload(m map[string]any, entry *logging.En
hr.Request.Proto = v["proto"].(string)
hr.RemoteIP = v["remote_ip"].(string) + ":" + v["remote_port"].(string)

if t, ok := v["headers"]; ok {
headers := t.(map[string]any)
for h, v := range headers {
hr.Header.Set(h, v.(string))
}
}
entry.HTTPRequest = &hr
//Caddy request contains more data, don't
//delete.
Expand Down

0 comments on commit cb70e7f

Please sign in to comment.