mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-03 12:37:36 +08:00
feat: add real_ip_recursive to nginx.conf (#4332)
This commit is contained in:
parent
7cf52c051e
commit
4d60170ee0
@ -229,6 +229,10 @@ http {
|
||||
real_ip_header {* http.real_ip_header *};
|
||||
{% end %}
|
||||
|
||||
{% if http.real_ip_recursive then %}
|
||||
real_ip_recursive {* http.real_ip_recursive *};
|
||||
{% end %}
|
||||
|
||||
{% if real_ip_from then %}
|
||||
{% print("\nDeprecated: apisix.real_ip_from has been moved to nginx_config.http.real_ip_from. apisix.real_ip_from will be removed in the future version. Please use nginx_config.http.real_ip_from first.\n\n") %}
|
||||
{% for _, real_ip in ipairs(real_ip_from) do %}
|
||||
|
@ -180,6 +180,7 @@ nginx_config: # config for render the template to generate n
|
||||
send_timeout: 10s # timeout for transmitting a response to the client.then the connection is closed
|
||||
underscores_in_headers: "on" # default enables the use of underscores in client request header fields
|
||||
real_ip_header: "X-Real-IP" # http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
|
||||
real_ip_recursive: "off" # http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_recursive
|
||||
real_ip_from: # http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
|
||||
- 127.0.0.1
|
||||
- 'unix:'
|
||||
|
@ -639,3 +639,21 @@ if ! grep "charset gbk;" conf/nginx.conf > /dev/null; then
|
||||
fi
|
||||
|
||||
echo "passed: found the 'charset gbk;' in nginx.conf"
|
||||
|
||||
# check realip recursive setting
|
||||
git checkout conf/config.yaml
|
||||
|
||||
echo '
|
||||
nginx_config:
|
||||
http:
|
||||
real_ip_recursive: "on"
|
||||
' > conf/config.yaml
|
||||
|
||||
make init
|
||||
|
||||
if ! grep "real_ip_recursive on;" conf/nginx.conf > /dev/null; then
|
||||
echo "failed: 'real_ip_recursive on;' not in nginx.conf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "passed: found 'real_ip_recursive on' in nginx.conf"
|
||||
|
Loading…
Reference in New Issue
Block a user