change: if we don't set any IP list, then any IP access is allowed by default for admin API.

This commit is contained in:
Yuansheng 2019-08-29 15:55:13 +08:00 committed by YuanSheng Wang
parent 124a49f267
commit 2400c048b7
2 changed files with 21 additions and 16 deletions

View File

@ -146,11 +146,12 @@ http {
listen {* port_admin *};
location /apisix/admin/ {
{% for _, allow_ip in ipairs(allow_admin or {}) do %}
allow {*allow_ip*};
{% end %}
deny all;
{%if allow_admin then%}
{% for _, allow_ip in ipairs(allow_admin) do %}
allow {*allow_ip*};
{% end %}
deny all;
{%end%}
content_by_lua_block {
apisix.http_admin()
}
@ -180,10 +181,12 @@ http {
{% if enable_admin and not port_admin then %}
location /apisix/admin {
{% for _, allow_ip in ipairs(allow_admin) do %}
allow {*allow_ip*};
{% end %}
deny all;
{%if allow_admin then%}
{% for _, allow_ip in ipairs(allow_admin) do %}
allow {*allow_ip*};
{% end %}
deny all;
{%end%}
content_by_lua_block {
apisix.http_admin()
@ -197,10 +200,12 @@ http {
location /apisix/dashboard/ {
index index.html;
{% for _, allow_ip in ipairs(allow_admin) do %}
allow {*allow_ip*};
{% end %}
deny all;
{%if allow_admin then%}
{% for _, allow_ip in ipairs(allow_admin) do %}
allow {*allow_ip*};
{% end %}
deny all;
{%end%}
alias dashboard/;

View File

@ -5,9 +5,9 @@ apisix:
enable_admin: true
enable_debug: false
enable_ipv6: true
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
- 127.0.0.0/24
- "::/64"
# allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
# - 127.0.0.0/24 # If we don't set any IP list, then any IP access is allowed by default.
# - "::/64"
# port_admin: 9180 # use a separate port
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