On 2019/2/23 18:18, Nick Ramirez wrote:
>
> If I set a variable like this:
>
>
> /http-request set-var(txn.allowed_methods) str("GET,POST,PUT")/
>
>
> Then I get an error:
>
>
> /parsing [/etc/haproxy/haproxy.cfg:20] : error detected in frontend
> 'fe_proxy' while parsing 'http-request set-var(txn.allowed_methods)'
> rule : fetch method 'str' : end of arguments expected at position 2,
> but got ',POST,PUT,OPTIONS'./
>
>
> This seems like HAProxy is parsing the comma as a delimiter between
> arguments to the str() fetch method instead of including it as part of
> the string that's surrounded by double quotes. Is this expected
> behavior? If so, is there a work-around? Some way to escape commas in
> a string passed to str()?
>
>
> Nick Ramirez
>
Yes this is known behavior. In the config documentation, on some of the
keywords, you'll see:
> Note that due to the config parser, it is not possible to use a comma
nor a closing parenthesis as delimitors.
You can get around it by using converters, and some sort of encoded
text, such as URL or base64. For example:
str(GET%2CPOST%2CPUT),url_dec()
-Patrick