-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: meta.filter in plugin doesn't work when we use some variable #7852
Comments
The filter evaluation should be postponed just before the plugin runs. |
Maybe we should run the filter at each phase and cache the results appropriately so the filter can be applied to every plugin. |
The cache is not necessary but an optional field, should be careful about it. |
Perhaps we could add |
Good idea I think. |
And still reserve the filter? What's the point? |
|
When will the |
when we add
|
I think that adding |
Current Behavior
When I use meta.filter in the plugin like this:
What I expect is that when the upstream_status is not equal to 200, then we will write a log into the file.
But now, the plugin will be executed even if the upstream_status is 200.
Reason:
Because when we do the plugin filter, we can't get the upstream_status (because we hadn't sent a request to upstream), so the value of
ngx.var.upstream_status
is nil, and the filter is always matched.apisix/apisix/plugin.lua
Lines 421 to 458 in 47187fa
Expected Behavior
The meta.filter can work even if the plugin is run at the log phase.
Error Logs
No response
Steps to Reproduce
Environment
apisix version
): 2.15.0uname -a
):openresty -V
ornginx -V
):curl http://127.0.0.1:9090/v1/server_info
):luarocks --version
):The text was updated successfully, but these errors were encountered: