Skip to content

Lua supports hosts #2385

Description

@ZJfans

When using connect, static resolution is not supported, only resolver is supported.It's forbidden here,https://github.com/ZJfans/lua-nginx-module/blob/master/src/ngx_http_lua_socket_tcp.c#L668 .

lua_pushcfunction(L, ngx_http_lua_socket_tcp_connect);
    lua_setfield(L, -2, "connect");

I studied the code and official documentation, https://www.f5.com/company/blog/nginx/dns-service-discovery-nginx-plus ,All modules set no_resolve to 1, which prohibits domain name resolution. I guess it is to prevent repeated resolution. It is only processed in https://github.com/nginx/nginx/blob/master/src/http/ngx_http_upstream_round_robin.c#L366 .

This is enough for nginx, but when I use openresty and use domain names from lua, I have to configure the resolver because hosts (which actually also includes the system's dns) are not supported. Currently I have introduced the dns module of kong, https://github.com/Kong/kong/tree/master/kong/resty/dns ,for hosts.

I'm not sure if I understand correctly, should we support hosts. it would only require a small change.
@zhuizhuhaomeng I'd appreciate it if you have time to look at this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions