Giter VIP home page Giter VIP logo

Comments (5)

agentzh avatar agentzh commented on September 14, 2024

@ruslantalpa I think the error message you are getting is already quite clear about the reason: set_current_peer does not support host names other than IP addresses.

You can, however, use the lua-resty-dns library in an earlier phase, like access_by_lua*, to resolve your domain names to IP addresses and save the IP addresses to ngx.ctx which can be later read in your balancer_by_lua*.

from lua-resty-core.

agentzh avatar agentzh commented on September 14, 2024

@ruslantalpa Oh, BTW, /etc/hosts is not supported (yet) in lua-resty-dns. So you'd better read that file yourself instead (but ensure you are caching the result otherwise reading a file upon every request can be quite expensive).

from lua-resty-core.

ruslantalpa avatar ruslantalpa commented on September 14, 2024

That's the answer i was looking for, to make sure it's a limitation and not me doing something wrong.
Thank you.

from lua-resty-core.

sempasha avatar sempasha commented on September 14, 2024

lua-resty-dns seems to be too complex for simple dns lookup. And there is no ``/etc/hosts` file support at all.

Is there any way to use something like nginx build in ngx_inet_resolve_host function?

from lua-resty-core.

agentzh avatar agentzh commented on September 14, 2024

@ruslantalpa Well, you can abstract out a simple Lua function atop lua-resty-dns for simple queries and you can parse /etc/hosts in Lua rather easily.

from lua-resty-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.