openresty / lua-nginx-module

Embed the Power of Lua into NGINX HTTP servers
https://openresty.org/
11.3k stars 2.03k forks source link

how can i bind interface #708

Open 6api opened 8 years ago

6api commented 8 years ago

like CURLOPT_INTERFACE there is a way to bind ip address via proxy_bind, and it not worked sometimes but it could not bind by interface name, like "ppp0"

agentzh commented 8 years ago

@6api Are you proposing this feature to ngx_lua or ngx_proxy? If it's the latter, then you should propose to the official nginx team instead (like on the official nginx mailing list) :)

6api commented 8 years ago

ngx_proxy is not possible, so i wish ngx_lua could resolved it by resty-http

https://github.com/pintsized/lua-resty-http/issues/51 This isn't possible right now, as far as I know. The cosocket API of the ngx_lua module would be responsible for this, but there is no bind function implemented. You may wish to raise this on the OpenResty mailing list, or create an issue over here: https://github.com/openresty/lua-nginx-module

doujiang24 commented 8 years ago

@6api My colleague XuHui is working on the tcpsock:bind, he will create a PR after my review. But we only support bind ip also, I'm not sure bind interface name is a good idea here?

https://github.com/coderxh/lua-nginx-module/commits/master