Search
Varnish Controller

vcli regexproutes

Handle regular expression routing targets

Synopsis

Handle regular expression routing targets, such as listing, add, delete or update.

Note that to match towards HTTP method, use 'Method'. And to match towards URI, use 'RequestURI'. For headers, just use
the header key such as 'User-Agent'.

When several regular expressions are defined, the first matching will be used for routing.

Examples:

vcli regexproutes list
vcli regexproutes -f id=1
vcli regexproutes -f name="MyRegExpRoute*"
vcli regexproutes add myRegExpRoute --reject --regexp=User-Agent:".*curl.*"
vcli regexproutes add myRegExpRoute --regexp='User-Agent:".*curl.*":1'
vcli regexproutes add myRegExpRoute --regexp=RequestURI:"\".*/images/.*\"":2
vcli regexproutes add myRegExpRoute --regexp='Method:"GET":1~2,RequestURI:"/test/*":1~3 --subdecision=weight (~<number represents weight(optional))
vcli regexproutes add myRegExpRoute --regexp-csv=my_regexps.csv
vcli regexproutes update 1 --name newname
vcli regexproutes delete 1
vcli regexproutes inspect 1

CSV: Note: For reject, only Header,RegExp is required.

Fields(csv line):
Header,RegExp,Tag ID,weight(optional)

Examples:

RequestURI,".*/images/.*",1,1
RequestURI,".*prod\"test\".*",2,2
RequestURI,"/live/.*",1

Weights: Represented by ~. Can be used to set priority between tags on the same RegExp-match. For example: –regexp=RequestURI:"/images/.":1~1,RequestURI:"./images/.":2~2 - Will give nodes with tag ID: 2 higher priority than tag ID: 1 for clients within RegExp match: “/images/.” because the weight: 2 is higher.

Options

  -h, --help   help for regexproutes

Options inherited from parent commands

  -c, --config string   configuration file for the CLI (default ~/.vcli.yml)
                        Could also be set via VARNISH_CONTROLLER_CLI_CONFIG=/path/to/config.yml
      --csv             Output the response table as CSV format.
  -j, --json            Output the response table as JSON format.

SEE ALSO


®Varnish Software, Wallingatan 12, 111 60 Stockholm, Organization nr. 556805-6203