You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2021/05/31 11:06:48 UTC

[apisix] branch master updated: feat: support custom variables_hash_max_size parameters in config.yaml (#4344)

This is an automated email from the ASF dual-hosted git repository.

tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 01360fb  feat: support custom variables_hash_max_size parameters in config.yaml (#4344)
01360fb is described below

commit 01360fb9ade94e198b215161734a32ae062f5797
Author: Yuelin Zheng <yu...@gmail.com>
AuthorDate: Mon May 31 19:06:39 2021 +0800

    feat: support custom variables_hash_max_size parameters in config.yaml (#4344)
---
 apisix/cli/ngx_tpl.lua   |  1 +
 conf/config-default.yaml |  1 +
 t/cli/test_main.sh       | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+)

diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index ceb1b55..d3196a4 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -213,6 +213,7 @@ http {
     client_header_timeout {* http.client_header_timeout *};
     client_body_timeout {* http.client_body_timeout *};
     send_timeout {* http.send_timeout *};
+    variables_hash_max_size {* http.variables_hash_max_size *};
 
     server_tokens off;
 
diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index 0042f73..03e680f 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -198,6 +198,7 @@ nginx_config:                     # config for render the template to generate n
       keepalive_timeout: 60s       # Sets a timeout during which an idle keepalive connection to an upstream server will stay open.
     charset: utf-8                 # Adds the specified charset to the "Content-Type" response header field, see
                                    # http://nginx.org/en/docs/http/ngx_http_charset_module.html#charset
+    variables_hash_max_size: 2048  # Sets the maximum size of the variables hash table.
 
 etcd:
   host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
diff --git a/t/cli/test_main.sh b/t/cli/test_main.sh
index 733d206..ca037fc 100755
--- a/t/cli/test_main.sh
+++ b/t/cli/test_main.sh
@@ -657,3 +657,21 @@ if ! grep "real_ip_recursive on;" conf/nginx.conf > /dev/null; then
 fi
 
 echo "passed: found 'real_ip_recursive on' in nginx.conf"
+
+# check the variables_hash_max_size setting
+git checkout conf/config.yaml
+
+echo '
+nginx_config:
+  http:
+    variables_hash_max_size: 1024
+' > conf/config.yaml
+
+make init
+
+if ! grep "variables_hash_max_size 1024;" conf/nginx.conf > /dev/null; then
+    echo "failed: 'variables_hash_max_size 1024;' not in nginx.conf"
+    exit 1
+fi
+
+echo "passed: found the 'variables_hash_max_size 1024;' in nginx.conf"