spacewander commented on a change in pull request #1364: support to run 
`header_filter` and `body_filter` phase for global rules.
URL: https://github.com/apache/incubator-apisix/pull/1364#discussion_r400126964
 
 

 ##########
 File path: lua/apisix.lua
 ##########
 @@ -435,12 +435,42 @@ end
 
 
 function _M.http_header_filter_phase()
-    run_plugin("header_filter")
+    local api_ctx = ngx.ctx.api_ctx
+    if not api_ctx then
+        return
+    end
+
+    if router.global_rules and router.global_rules.values
+            and #router.global_rules.values > 0
+    then
+        local plugins = core.tablepool.fetch("plugins", 32, 0)
+        for _, global_rule in ipairs(router.global_rules.values) do
+            core.table.clear(plugins)
+            plugins = plugin.filter(global_rule, plugins)
+            run_plugin("header_filter",plugins,api_ctx)
 
 Review comment:
   Need a space after the comma.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to