You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/03/30 12:00:41 UTC

[GitHub] [incubator-apisix] Akayeshmantha commented on a change in pull request #1364: support to run `header_filter` and `body_filter` phase for global rules.

Akayeshmantha 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_r400135615
 
 

 ##########
 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:
   oh sorry fixed it 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services