Merge pull request #3194 from bshelton229/literal-dollar-character
Make literal $ character work in set $location_path
This commit is contained in:
commit
f56ab42cd2
3 changed files with 48 additions and 1 deletions
|
|
@ -120,6 +120,7 @@ var (
|
|||
}
|
||||
return true
|
||||
},
|
||||
"escapeLiteralDollar": escapeLiteralDollar,
|
||||
"shouldConfigureLuaRestyWAF": shouldConfigureLuaRestyWAF,
|
||||
"buildLuaSharedDictionaries": buildLuaSharedDictionaries,
|
||||
"buildLocation": buildLocation,
|
||||
|
|
@ -161,6 +162,20 @@ var (
|
|||
}
|
||||
)
|
||||
|
||||
// escapeLiteralDollar will replace the $ character with ${literal_dollar}
|
||||
// which is made to work via the following configuration in the http section of
|
||||
// the template:
|
||||
// geo $literal_dollar {
|
||||
// default "$";
|
||||
// }
|
||||
func escapeLiteralDollar(input interface{}) string {
|
||||
inputStr, ok := input.(string)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
return strings.Replace(inputStr, `$`, `${literal_dollar}`, -1)
|
||||
}
|
||||
|
||||
// formatIP will wrap IPv6 addresses in [] and return IPv4 addresses
|
||||
// without modification. If the input cannot be parsed as an IP address
|
||||
// it is returned without modification.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue