hash user_$arg_username;
取url中参数的值,参数名为username
node2:/etc/nginx#curl -H 'X-Forwarded-For: 19.1.20.200' http://192.168.137.2:2443/aa?username=bbb
8012 server response.nnode2:/etc/nginx#
node2:/etc/nginx#curl -H 'X-Forwarded-For: 19.1.20.200' http://192.168.137.2:2443/aa?username=mmm
8011 server response.nnode2:/etc/nginx#
upstream rrups {
hash user_$arg_username;
server 192.168.137.3:8011;
server 192.168.137.3:8012;
}
[192.168.137.2]|[192.168.137.3]- 192.168.137.3 - - [25/Sep/2020:20:11:41 +0800] "GET /aa?username=bbb HTTP/1.1" 200 22 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.44 zlib/1.2.3 libidn/1.18 libssh2/1.4.2" "19.1.20.200" "/usr/local/nginx/html/aa"
[192.168.137.2]|[192.168.137.3]- 192.168.137.3 - - [25/Sep/2020:20:11:43 +0800] "GET /aa?username=mmm HTTP/1.1" 200 22 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.44 zlib/1.2.3 libidn/1.18 libssh2/1.4.2" "19.1.20.200" "/usr/local/nginx/html/aa"