RowgerGo commented on issue #12442: URL: https://github.com/apache/apisix/issues/12442#issuecomment-3087322928
> This is the expected result. When processing header values, APISIX calls the `core.utils.resolve_var` function to replace variables. This function uses the regular expression `(?<!\\)\$(\{(\w+)\}|(\w+))` to match variables in the format of `$variable` or `${variable}`. When a variable is matched but does not exist in the context, it is replaced by an empty string. > > This is not a bug, but a design feature of APISIX. This feature allows using Nginx variables in header values (such as `$request_id`, `$remote_addr`, etc.), but the side effect is that any string containing a `$` sign followed by alphanumeric characters will be treated as a variable. > > I can't think of a good solution. Currently, you can only avoid using the `$` symbol in the string, or further encode the string. Looking forward to other people's ideas thanks, I can understand what you're saying, I suggest using a more specialized string instead of the $symbol for variable definition, such as {{variable}}, instead of $variable, because the probability of a single symbol $appearing in a string is higher. This is just my suggestion. If the changes have a significant impact, they can be abandoned. We have decided to use a string without the symbol $ when setting the value in the custom header -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org