BuildLogFormatUpstream function was always using the default log-format-upstream,
This commit is contained in:
parent
0b48d3b24d
commit
1e5081baf2
3 changed files with 16 additions and 6 deletions
|
|
@ -264,7 +264,7 @@ func NewDefault() Configuration {
|
|||
KeepAlive: 75,
|
||||
LargeClientHeaderBuffers: "4 8k",
|
||||
LogFormatStream: logFormatStream,
|
||||
LogFormatUpstream: BuildLogFormatUpstream(false),
|
||||
LogFormatUpstream: BuildLogFormatUpstream(false, ""),
|
||||
MaxWorkerConnections: 16384,
|
||||
MapHashBucketSize: 64,
|
||||
ProxyRealIPCIDR: defIPCIDR,
|
||||
|
|
@ -307,7 +307,14 @@ func NewDefault() Configuration {
|
|||
}
|
||||
|
||||
// BuildLogFormatUpstream format the log_format upstream based on proxy_protocol
|
||||
func BuildLogFormatUpstream(useProxyProtocol bool) string {
|
||||
func BuildLogFormatUpstream(useProxyProtocol bool, curLogFormatUpstream string) string {
|
||||
|
||||
// test if log_format comes from configmap
|
||||
if curLogFormatUpstream != "" &&
|
||||
curLogFormatUpstream != fmt.Sprintf(logFormatUpstream, "$proxy_protocol_addr") &&
|
||||
curLogFormatUpstream != fmt.Sprintf(logFormatUpstream, "$remote_addr") {
|
||||
return curLogFormatUpstream
|
||||
}
|
||||
|
||||
if useProxyProtocol {
|
||||
return fmt.Sprintf(logFormatUpstream, "$proxy_protocol_addr")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue