feat: support enbale nginx debug_connection (#8637)
This commit is contained in:
parent
0005c080da
commit
2852e2998c
5 changed files with 39 additions and 0 deletions
|
|
@ -65,6 +65,7 @@ const (
|
|||
globalAuthAlwaysSetCookie = "global-auth-always-set-cookie"
|
||||
luaSharedDictsKey = "lua-shared-dicts"
|
||||
plugins = "plugins"
|
||||
debugConnections = "debug-connections"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -111,6 +112,7 @@ func ReadConfig(src map[string]string) config.Configuration {
|
|||
blockRefererList := make([]string, 0)
|
||||
responseHeaders := make([]string, 0)
|
||||
luaSharedDicts := make(map[string]int)
|
||||
debugConnectionsList := make([]string, 0)
|
||||
|
||||
//parse lua shared dict values
|
||||
if val, ok := conf[luaSharedDictsKey]; ok {
|
||||
|
|
@ -373,6 +375,24 @@ func ReadConfig(src map[string]string) config.Configuration {
|
|||
delete(conf, plugins)
|
||||
}
|
||||
|
||||
if val, ok := conf[debugConnections]; ok {
|
||||
delete(conf, debugConnections)
|
||||
for _, i := range splitAndTrimSpace(val, ",") {
|
||||
validIp := net.ParseIP(i)
|
||||
if validIp != nil {
|
||||
debugConnectionsList = append(debugConnectionsList, i)
|
||||
} else {
|
||||
_, _, err := net.ParseCIDR(i)
|
||||
if err == nil {
|
||||
debugConnectionsList = append(debugConnectionsList, i)
|
||||
} else {
|
||||
klog.Warningf("%v is not a valid IP or CIDR address", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
to.DebugConnections = debugConnectionsList
|
||||
}
|
||||
|
||||
to.CustomHTTPErrors = filterErrors(errors)
|
||||
to.SkipAccessLogURLs = skipUrls
|
||||
to.WhitelistSourceRange = whiteList
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue