Skip to content

bug: built-in variables are not supported in _meta.filter #8251

Description

@bzp2010

Current Behavior

The filters in the plugin support only Nginx variables, not APISIX's built-in variables.

For example, I can use the Nginx variable http_xxx, but I can't use APISIX custom variables like arg_xxxx or graphql_xxxx.

Expected Behavior

It can support all APISIX variable syntax, including cookie_xxxx, arg_xxxx, post_arg_xxxx, graphql_xxxx, etc.

Error Logs

No response

Steps to Reproduce

  1. Set the filter in the plugin to use the above unsupported syntax.

The reason is that we didn't pass in our ctx for that expr executor, and the expr uses its default ngx.var, which wouldn't support extended syntax.

https://github.com/apache/apisix/blob/master/apisix/plugin.lua#L437
https://github.com/api7/lua-resty-expr/blob/main/lib/resty/expr/v1.lua#L376

We just need to change it to ok, err = ex:eval(ctx.var) and it will support those extended syntaxes.

Environment

  • APISIX version (run apisix version): 3.0.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions