2016-02-22 00:13:08 +00:00
|
|
|
http = require "resty.http"
|
2016-03-19 20:17:58 +00:00
|
|
|
def_backend = "http://upstream-default-backend"
|
2016-02-22 00:13:08 +00:00
|
|
|
|
2016-03-19 20:17:58 +00:00
|
|
|
function openURL(status)
|
2016-02-22 00:13:08 +00:00
|
|
|
local httpc = http.new()
|
|
|
|
|
2016-03-19 20:17:58 +00:00
|
|
|
local res, err = httpc:request_uri(def_backend, {
|
2016-02-22 00:13:08 +00:00
|
|
|
path = "/",
|
2016-03-16 14:12:45 +00:00
|
|
|
method = "GET",
|
|
|
|
headers = {
|
2016-03-19 20:17:58 +00:00
|
|
|
["Content-Type"] = ngx.var.httpAccept or "html",
|
2016-03-16 14:12:45 +00:00
|
|
|
}
|
2016-02-22 00:13:08 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
if not res then
|
|
|
|
ngx.log(ngx.ERR, err)
|
|
|
|
ngx.exit(500)
|
|
|
|
end
|
|
|
|
|
|
|
|
ngx.status = tonumber(status)
|
|
|
|
if ngx.var.http_cookie then
|
|
|
|
ngx.header["Cookie"] = ngx.var.http_cookie
|
|
|
|
end
|
|
|
|
|
|
|
|
ngx.say(res.body)
|
|
|
|
end
|