我在nginx lua上实现了lua-resty-http模块。但是nginx.conf文件中的content_by_lua代码无效(意味着没有触发)。
nginx.conf代码:
server {
location {
content_by_lua '
local http = require "resty.http.simple"
local httpc = http.new()
httpc:set_timeout(500)
httpc:connect("127.0.0.1", 80)
local res, err = httpc:request({
path = "/example/sample/test",
headers = {
["Host"] = "example.abc.com",
},
})
';
}
}
任何解决方案??