Allow custom forwarded for header
This commit is contained in:
parent
6146bc4dc2
commit
c24e212aac
3 changed files with 21 additions and 7 deletions
|
|
@ -157,6 +157,7 @@ var (
|
|||
},
|
||||
"buildAuthSignURL": buildAuthSignURL,
|
||||
"isValidClientBodyBufferSize": isValidClientBodyBufferSize,
|
||||
"buildForwardedFor": buildForwardedFor,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -640,3 +641,14 @@ func getIngressInformation(i, p interface{}) *ingressInformation {
|
|||
|
||||
return info
|
||||
}
|
||||
|
||||
func buildForwardedFor(input interface{}) string {
|
||||
s, ok := input.(string)
|
||||
if !ok {
|
||||
glog.Errorf("expected an string type but %T was returned", input)
|
||||
}
|
||||
|
||||
ffh := strings.Replace(s, "-", "_", -1)
|
||||
ffh = strings.ToLower(ffh)
|
||||
return fmt.Sprintf("$http_%v", ffh)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue