openresty / openresty/lua-resty-core
Unix sockets work but are not documented
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 853
- Forks
- 286
- Avg merge
- 35m
- Merged PRs (30d)
- 1
Description
The following configuration using a unix socket as the current peer works, but it is not documented.
Adding the line:
local ok, err = balancer.set_current_peer('some_unix_socket_name');
would suffice
http {
upstream backend {
server 0.0.0.1; # just an invalid address as a place holder
balancer_by_lua_block {
local balancer = require "ngx.balancer"
local suname = 'unix:/tmp/nginx_socket';
local ok, err = balancer.set_current_peer(suname);
if not ok then
ngx.log(ngx.ERR, "failed to set the current peer: ", err)
return ngx.exit(500)
end
}
}
server {
listen 8080;
location /S/ {
proxy_pass http://backend/S/;
}
}
server {
listen unix:/tmp/nginx_socket;
location /S/__debug {
content_by_lua_file ./locations/debug;
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the documentation entry point for the ngx.balancer.set_current_peer API. Use the Unix-socket configuration shown in the issue as the example, and consider the documentation complete when it explains that a unix socket name can be passed as the current peer with the required format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100