kellyseeme commented on issue #9433:
URL: https://github.com/apache/apisix/issues/9433#issuecomment-1546699998

   > Hi @kellyseeme , you can adjust the order of execution by plugin 
priorities, given that they are executed in the same phase (e.g. rewrite, 
access).
   > 
   > Note that `ip-restriction` has a [default priority of 
3000](https://github.com/apache/apisix/blob/e85ef647471effdc2eb861a9bc29565660172558/conf/config-default.yaml#L426)
 and `real-ip` has a [default priority of 
23000](https://github.com/apache/apisix/blob/e85ef647471effdc2eb861a9bc29565660172558/conf/config-default.yaml#L412).
 Plugin that has the higher priority will be executed first **within the same 
phase**.
   > 
   > In your specific case, [`ip-restriction` is in 
rewrite](https://github.com/apache/apisix/blob/e85ef647471effdc2eb861a9bc29565660172558/apisix/plugins/ip-restriction.lua#L23)
 and [`real-ip` is in 
access](https://github.com/apache/apisix/blob/e85ef647471effdc2eb861a9bc29565660172558/apisix/plugins/real-ip.lua#L132).
 Logic in rewrite will be executed before the logic of access regardless of 
priority, so `ip-restriction` is executed first out of the two.
   > 
   > For more info, see [Plugin Execution 
Order](https://docs.api7.ai/apisix/key-concepts/plugins#plugins-execution-order)
 doc.
   
   tks for reply,in my test,if all the two plugins in one globalrules,then the 
real_ip and ip-restriction worked in my desired,first execute real_ip,and then 
ip_restriction,but if in two globalrules,then the ip-restriction is first 
execute,why this happen?
   
   other words, in nginx,the real_ip is the first phase of post-read,why in 
apisix this is in rewrite phase?if we dont have the real_ip,then why can get 
the ture client ip for ip restriction?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to