The location match contains protocol, host, port and path fields that may be used to match the URL of the request. Any of the fields may be left blank, in which case they will match any value.
Wildcards are supported using either *, ? or character ranges [...]. The * matches zero or more characters. The ? matches one character. Character ranges match one character in the range, eg. [a-z] or [aeiou].
To match subpaths you must end your path with a /*. NOTE: In previous versions of Charles this was implicit, but it is now required.
The query field matches the query string contents. Do not include the ? that starts the query string. Note that the ? character is a wildcard character.
The query field can include wildcards, like the other fields, so you can do queries such as: "*page=1*" to match "page=1" anywhere in the query string.
To match every request to a given host enter the host name and leave the other fields blank. To match every request to a given path on a host enter the host name and the path ending with a /, leave the other fields blank. To match every file with a given suffix on a host enter the host name and /*.suffix, leave the other fields blank.
Host | Path | Result |
---|---|---|
charlesproxy.com | Matches all requests to host charlesproxy.com | |
*.charlesproxy.com | Matches all requests to hosts ending in .charlesproxy.com | |
charlesproxy.com | /charles/ | Matches all requests to charlesproxy.com/charles/ only |
charlesproxy.com | /charles/* | Matches all requests to charlesproxy.com/charles/ including files and subpaths |
charlesproxy.com | /charles | Matches all requests to charlesproxy.com/charles only |
charlesproxy.com | /index.html | Matches all requests to charlesproxy.com/charles.html only |
charlesproxy.com | /*.html | Matches all requests to files ending in .html on host charlesproxy.com |
/charles/*.html | Matches all requests to files ending in .html under the path /charles/ (including subpaths) on any host |
Protocol and port matches can be added to the above to further narrow the location match.