23 lines
489 B
Plaintext
23 lines
489 B
Plaintext
set api_uri "%API_URI%";
|
|
|
|
rewrite_by_lua_block {
|
|
|
|
local api = require "api"
|
|
|
|
if api.is_api_call() then
|
|
ngx.header.content_type = 'text/plain'
|
|
if api.do_api_call() then
|
|
ngx.log(ngx.WARN, "[API] API call " .. ngx.var.request_uri .. " successfull from " .. ngx.var.remote_addr)
|
|
ngx.say("ok")
|
|
else
|
|
ngx.log(ngx.WARN, "[API] API call " .. ngx.var.request_uri .. " failed from " .. ngx.var.remote_addr)
|
|
ngx.say("ko")
|
|
end
|
|
|
|
ngx.exit(ngx.HTTP_OK)
|
|
|
|
end
|
|
|
|
ngx.exit(ngx.OK)
|
|
}
|