bzp2010 commented on code in PR #12435: URL: https://github.com/apache/apisix/pull/12435#discussion_r2222878944
########## apisix/plugins/forward-auth.lua: ########## @@ -124,13 +125,19 @@ function _M.access(conf, ctx) if type(value) == "number" then value = tostring(value) end - local resolve_value, err = core.utils.resolve_var(value, ctx.var) - if not err then - auth_headers[header] = resolve_value - end - if err then - core.log.error("failed to resolve variable in extra header '", - header, "': ",value,": ",err) + if core.string.has_prefix(value, "$") then + -- If the value starts with a dollar sign, treat it as a variable + -- and resolve it from the context. + local sub_str_len = #value - 1 -- Exclude the dollar sign + if sub_str_len > 0 then + local trimmed_value = sub_str(value, 2) -- Remove the dollar sign + local resolve_value = ctx.var[trimmed_value] + if resolve_value then + auth_headers[header] = resolve_value + end + end + else + auth_headers[header] = value Review Comment: If `$post_arg.` is not supported, change the format of `$post_arg.`. This change has not been included in any of the new releases, and variable parsing support is widely used. -- 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