开发者

Limiting copas to a particular domain name: Allowing multiple web servers

I'm trying to limit the domain name in whi开发者_Python百科ch copas receives sockets, with the end goal of allowing other web servers to handle requests with other domain names on the same machine. In this particular case, when I use

copas.addserver(assert(socket.bind("*", 80)),
    function(c)
        return handler(copas.wrap(c), c:getpeername())
    end
)

It correctly handles the request and returns a response as expected. However, when I replace "*" with "localhost", my results are mixed. Is this the correct way to go about listening for sockets with a specific domain name (obviously substituting the preferred name in place of localhost)? Will this allow for other web servers to serve content alongside it for other domain names?

Edit: It appears that it is working, but will accept any sockets based on IP, not DNS name. Does this mean that I will need multiple IPs to serve multiple DNS names?


You might take a look at Xavante which is a webserver from the Kepler project. It does support virtual hosts, so it might be what you're looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜