URI

Note: URI format: http://host[:port\]/path/?query](http://host/path/?query)

Common Condition Primitive Parameter

  • patterns: String, representing multiple patterns, format is as “pattern1|pattern2”
  • case_insensitive: Bool, case insensitive

Host

  • req_host_in(patterns)

    • Judge if host matches configured patterns
    • Case insensitive

      1. // match www.bfe-networks.com or bfe-networks.com, case insensitive
      2. req_host_in(“www.bfe-networks.com|bfe-networks.com”)
    • Note: the both sides of | can not be space```

      right:

      req_host_in(“www.bfe-networks.com|bfe-networks.com”)

    wrong:

    req_host_in(“www.bfe-networks.com | bfe-networks.com”)```

Path

  • req_path_in(patterns, case_insensitive)

    • Judge if request path matches configured patterns
      1. // if path is /abc,case insensitive
      2. req_path_in(“/abc”, true)
  • req_path_prefix_in(patterns, case_insensitive)

    • Judge if request path prefix matches configured patterns
      1. // if path prefix is /abc,case insensitive
      2. req_path_prefix_in(“/x/y”, false)
  • req_path_suffix_in(patterns, case_insensitive)

    • Judge if request path suffix matches configured patterns
      1. // if path suffix is /abc,case insensitive
      2. req_path_suffix_in(“/x/y”, false)

Note:The patterns of req_path_in and req_path_prefix_in need to be included “/“

Query

  • req_query_key_in(patterns)

    • Judge if query key matches configured patterns
      1. # if key in query is abc
      2. req_query_key_exist(“abc”)
  • req_query_key_prefix_in(patterns)

    • Judge if query key prefix matches configured patterns
      1. # if key prefix in query is abc
      2. req_query_key_prefix_in(“abc”)
  • req_query_value_in(key, patterns, case_insensitive)

    • Judge if value of query key matches configured patterns
      1. # if the value of abc in query is XXX, case insensitive
      2. req_query_value_in(“abc”, "XXX", true)
  • req_query_value_prefix_in(key, patterns, case_insensitive)

    • Judge if value prefix of query key matches configured patterns
      1. # if the value prefix of abc in query is XXX, case insensitive
      2. req_query_value_prefix_in(“abc”, "XXX", true)
  • req_query_value_suffix_in(key, patterns, case_insensitive)

    • Judge if value suffix of query key matches configured patterns
      1. # if the value suffix of abc in query is XXX, case insensitive
      2. req_query_value_suffix_in(“abc”, "XXX", true)
  • req_query_value_hash_in(key, patterns, case_insensitive)

    • Judge if the hash value of specified query matches configured patterns (value after hash is 0~9999)
      1. # if the hash value of query abc is 100, case insensitive
      2. req_query_value_hash_in(“abc”, "100", true)

Port

  • req_port_in(patterns)
    • Judge if port matches configured patterns
      1. # check if port is 80 or 8080
      2. req_port_in(“80|8080”)

URL

  • req_url_regmatch(patterns)
    • patterns is regular expression to match yrl
    • ` is recommended using
      1. # check if url is "/s?word=123"
      2. req_url_regmatch(`/s\?word=123`)