lua-resty-http icon indicating copy to clipboard operation
lua-resty-http copied to clipboard

Unable to call client:request using 127.0.0.1

Open nrgyzer opened this issue 12 years ago • 0 comments

Hi,

my code is the following:

local http = require "resty.http"
local client = http:new()
client:set_timeout(3000)

local ok, err = client:connect("127.0.0.1", 9999)

if not ok then
    ngx.say(err)
    return
end

ngx.say("abc");
local res, err = client:request({path = "/requestedFile"})
ngx.say("def");
ngx.flush(true);

nginx writes "abc", but no "def" or similar (for testing purposes). It seems that client:request() throws an error or something similar that forces nginx to cancel the execution. Is there anything special by using 127.0.0.1/localhost? I also tried localhost instead of 127.0.0.1 but I always got "localhost could not be resolved (3: Host not found)".

nrgyzer avatar Mar 16 '13 21:03 nrgyzer