local env = {ngx = ngx}
local hacked_set_header_function = function() end
env.ngx.req.set_header = hacked_set_header_function
-- f is function
setfenv(f, env)
pcall(f)
-- result is
-- ngx.req.set_header is modified
Is there anyway to write an openresty sandbox without modify _G.ngx ?