nanamikon commented on issue #3261:
URL: https://github.com/apache/apisix/issues/3261#issuecomment-758768247


   @spacewander 
   I am new to apisix,  and I test this function follow your tips using 
test-nginx。
   I have following points to discuss
   
   1. the key of hash_on can be defined as  “vars_combinations”,     refers to 
http://nginx.org/en/docs/stream/ngx_stream_upstream_module.html
   ```
   The key can contain text, variables, and their combinations (1.11.2)
   ```
   
   2. In upstreams.lua,  should I check the schema in this situation?  I think 
it is no need to do this, because it is an advance feature
   ```
   local function get_chash_key_schema(hash_on)
       if not hash_on then
           return nil, "hash_on is nil"
       end
   
       if hash_on == "vars" then
           return core.schema.upstream_hash_vars_schema
       end
   
       if hash_on == "header" or hash_on == "cookie" then
           return core.schema.upstream_hash_header_schema
       end
   
       if hash_on == "consumer" then
           return nil, nil
       end
       return nil, "invalid hash_on type " .. hash_on
   end
   ```
   3.  If all vals are not exist, for example
   ```
   $request_uri-$host
   ``` 
   the hash on should be "-",  and will not use default chash_key 
"remote_addr",  is it acceptable?
   Refer to https://trac.nginx.org/nginx/ticket/765,  any plan to support map? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to