Hello,
Having some trouble due to an error I'm getting.
This function connects a socket to a host that is first resolved to an ip address (custom dns resolver);
local connect = function(sock, host, port, opts)
local target_ip, target_port = dns_client.toip(host, port)
if not target_ip then return nil, target_port end
return sock:connect(target_ip, target_port, opts)
end
It is called as;
local sock = ngx_socket_tcp()
sock:settimeout(conf.timeout)
ok, error = connect(sock, host, port)
The error I'm getting;
2016/08/26 23:36:40 [crit] 39494#0: *26 connect() to xx.xxx.xx.xxx:0 failed (49: Can't assign requested address), client: 127.0.0.1, server: kong, request: "GET /request HTTP/1.1", host: "ldap.com"
The IP address and port are properly resolved.
Have been googling around, but haven't been able to find an answer.
Any help solving this is appreciated.
Thx
Thijs
BTW; on osx if that matters...