Skip to content

Commit

Permalink
feature: support multiple ips of allow. (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
moonming authored Jul 31, 2019
1 parent 9e6fceb commit f8deb1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 8 additions & 4 deletions bin/apisix
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,11 @@ http {
listen {* port_admin *};
location /apisix/admin {
allow {*allow_admin*};
{% for _, allow_ip in ipairs(allow_admin) do %}
allow {*allow_ip*};
{% end %}
deny all;
content_by_lua_block {
apisix.http_admin()
}
Expand All @@ -173,8 +176,11 @@ http {
{% if enable_admin and not port_admin then %}
location /apisix/admin {
allow {*allow_admin*};
{% for _, allow_ip in ipairs(allow_admin) do %}
allow {*allow_ip*};
{% end %}
deny all;
content_by_lua_block {
apisix.http_admin()
}
Expand Down Expand Up @@ -356,8 +362,6 @@ local function init()
sys_conf[k] = v
end

-- print(sys_conf.allow_admin)

local conf_render = template.compile(ngx_tpl)
local ngxconf = conf_render(sys_conf)

Expand Down
5 changes: 3 additions & 2 deletions conf/config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
apisix:
node_listen: 9080 # Apisix listening port
node_listen: 9080 # APISIX listening port
node_ssl_listen: 9443
enable_heartbeat: true
enable_admin: true
enable_debug: false
allow_admin: "127.0.0.0/24"
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
- 127.0.0.0/24
real_ip_header: "X-Real-IP" # http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
real_ip_from: # http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
- 127.0.0.1
Expand Down

0 comments on commit f8deb1e

Please sign in to comment.