Use nginx upstreams and reload only if configuration changes

This commit is contained in:
Manuel de Brito Fontes 2016-03-14 23:29:13 -03:00
parent d0a15b1267
commit cad814cbb3
50 changed files with 370 additions and 10432 deletions

View file

@ -21,30 +21,3 @@ function openURL(status, page)
ngx.say(res.body)
end
function openCustomErrorURL(status, page)
local httpc = http.new()
data = {}
data["code"] = status
data["format"] = ngx.var.httpAccept
local params = "/error?"..ngx.encode_args(data)
local res, err = httpc:request_uri(page, {
path = params,
method = "GET"
})
if not res then
ngx.log(ngx.ERR, err)
ngx.exit(500)
end
ngx.status = tonumber(status)
ngx.header["Content-Type"] = ngx.var.httpReturnType or "text/plain"
if ngx.var.http_cookie then
ngx.header["Cookie"] = ngx.var.http_cookie
end
ngx.say(res.body)
end