Skip to content

request help: support configurating the node listening address #4853

Description

@wayne-cheng

Issue description

I hope that apisix could be configurated the listening address.
In some special cases, for example, I plan to use a combination of APISIX and Keepalived to achieve high availability.
I will turn on the relevant Linux kernel parameters (to enable the program to listen the IP that does not exist on the local host):

echo "net.ipv4.ip_nonlocal_bind=1" >> /etc/sysctl.conf

Then, bind a virtual IP (vip) to APISIX. However, the current APISIX configuration does not support specifying the listening address, although this is a regular usage in nginx.
I tried to modify the node_listen configuration of config.yaml like this:

apisix:
  node_listen:
  - port: 192.168.0.244:9080

This trick can meet the needs of configurating listening addresses. But the listening address of https cannot be modified in this way. listen_port can only accept parameters of type number:

apisix:
  # ...
  ssl:
    enable: true
      enable_http2: true
      listen_port: 9443

The parsing of config.yaml needs to be optimized.
I am willing to submit a PR If you think it's suitable.

Environment

  • apisix version: 2.8
  • OS: Linux apisix-7c455cb576-kjbjw 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 Linux
  • OpenResty version: nginx version: openresty/1.19.3.1
    built by gcc 10.2.1 20201203 (Alpine 10.2.1_pre1)
    built with OpenSSL 1.1.1k 25 Mar 2021
    TLS SNI support enabled
    configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.19 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.9 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-pcre --with-compat --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-ipv6 --with-mail --with-mail_ssl_module --with-md5-asm --with-pcre-jit --with-sha1-asm --with-stream --with-stream_ssl_module --with-threads --with-stream --with-stream_ssl_preread_module

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions