集群服务设置--访问日志中可以设置是否只记录通用Header

This commit is contained in:
GoEdgeLab
2022-10-24 14:39:18 +08:00
parent 1c80781387
commit f59c55b25a
2 changed files with 24 additions and 2 deletions

View File

@@ -62,7 +62,13 @@ func (this *HTTPRequest) log() {
// 请求Header
var pbReqHeader = map[string]*pb.Strings{}
if ref == nil || ref.ContainsField(serverconfigs.HTTPAccessLogFieldHeader) {
// 是否只记录通用Header
var commonHeadersOnly = this.nodeConfig != nil && this.nodeConfig.GlobalServerConfig != nil && this.nodeConfig.GlobalServerConfig.HTTPAccessLog.CommonRequestHeadersOnly
for k, v := range this.RawReq.Header {
if commonHeadersOnly && !serverconfigs.IsCommonRequestHeader(k) {
continue
}
pbReqHeader[k] = &pb.Strings{Values: v}
}
}