The installation
npm i whistle -g
Basic operations and supporting Settings
-
W2 start Start w2 restart Restart W2 stop Stop the service W2 Status Whistle Current status
http://127.0.0.1:8899/, Whistle starts a service with port 8899 by default
-
The Chrome plugin switchyOmega configuration agent has the domain name 127.0.0.1 and port 8899. Any browser that Chrome opens will be requested by the Whistle agent
SwitchyOmega After configuring the proxy, manually switch the proxy mode. The black icon of switchyOmega indicates the system proxy, the gray icon indicates the direct connection mode, and the light blue icon indicates the proxy proxy. Whistle does not work without opening the whistle agent
-
If you use a mobile phone, the mobile phone and the computer are in the same network segment, open the wifi to manually configure the proxy: IP is the IP of the computer, the port is 8899
-
Both PC and mobile devices need to download the Whistle certificate and store it in a trusted certificate to enable HTTPS packet capture
-
For options requests, open the developer tool of the browser and select Disable cache. Otherwise, options requests can be caught only once, but real requests cannot be caught
Local service configuration proxy
When you open the react project build file, there will be a cross-domain request problem. You can use Whistle to configure the domain name proxy directly. The process is as follows:
- The react project build
- Run my own server, open the file after build, I am running on port 9999,
localhost:9999
At this point, the interface appears cross-domain - Open whistle and configure a Rules:
example.com localhost:9999
.example.com
Is the address of the cross-domain interface - Browser open
example.com
The proxy to accesslocalhost:9999
At this point, there are no cross-domain problems
Configuration rules
- Local file or file path replacement. The protocol header can be added or not added. If the protocol header is not added, all protocols are matched. Path substitution is similar to Willow.
CTC. I.g timg. Cn/qzone/biz/GDT/atlas/mod/message. The HTML C: \ Users \ ouvenzhang \ Desktop \ edit HTML # local replacement of a single file CTC. I.g timg. Cn/qzone/biz/C: \ Users \ ouvenzhang \ Desktop/biz/build/replace # file path, Generally use this article to http://ctc.i.gtimg.cn/qzone/biz/ C: \ Users \ ouvenzhang \ Desktop/biz/build / # only for HTTP request file path to replaceCopy the code
- Request forwarding: forwards a specified domain name request to another domain name
www.qq.com ke.qq.com # All subdomain names of qq.com have been forwardedCopy the code
- Script injection, you can inject a script (HTML, JS, CSS fragments) into a DOM page for debugging
ke.qq.com html://E:\xx\test\test.html
ke.qq.com js://C:\Users\ouvenzhang\Desktop\gdt\console.js
ke.qq.com css://E:\xx\test\test.css
Copy the code
- Match pattern, can match the path according to the re
\ \Users\ouvenzhang\Desktop\ GDT \edit.html # \ \Users\ouvenzhang\Desktop\ GDT \edit Ke.qq.com/atlas/25610/order/edit C: \ Users \ ouvenzhang \ Desktop \ GDT \ edit HTML # match directlyCopy the code
- The request content of the feature is ignored
Rule | / qq.com/ filter: / / hide # ignore contains qq request under the domain name is not shown in the network/spa \ monitor \. Min \. Js/I filter: / / rule # Ignore matches that contain spa-monitor.min.js, but display in network, equivalent to file whitelistCopy the code
- The default priorities of the same protocol rules are from top to bottom. That is, the earlier rules have higher priorities than the later rules. For example:
www.test.com 127.0. 01.:9999
www.test.com/xxx 127.0. 01.:8080
Copy the code
Request to www.test.com/xxx/index.h… In the top-down matching order, only www.test.com 127.0.0.1:9999 will be matched, which is the reverse of the traditional hosts configuration.
To match the hosts in the same order, you can change the Rules > Settings > Back Rules first on the page. However, this rule takes effect only for the Rules configured on the page, and does not take effect for the built-in Rules in the plug-in or remote Rules inline through @.
- With the exception of rules and proxy rules, rules of different protocols can be matched at the same time
www.test.com 127.0. 01.:9999
www.test.com/xxx 127.0. 01.:8080
www.test.com proxy:/ / 127.0.0.1:8888
www.test.com/xxx socks:/ / 127.0.0.1:1080
www.test.com pac://http://www.pac-server.com/test.pac
www.test.com/xxx http://www.abc.com
www.test.com file:///User/xxx/test
Copy the code
Request to www.test.com/xxx/index.h… The following rules will be matched from top to bottom, as well as the second rule:
www.test.com 127.0. 01.:9999
www.test.com proxy:/ / 127.0.0.1:8888
www.test.com pac://http://www.pac-server.com/test.pac
www.test.com/xxx http://www.abc.com
Copy the code
Proxy, HTTP-proxy, HTTPS -proxy, and SOCKS belong to proxy, and HTML and file belong to rule. Therefore, the two protocols can only match the one with the highest priority.
- Rules that belong to different protocols but have conflicting functions, such as rule, host, and proxy, are set to Rule > Host > Proxy, for example:
Filter condition setting
-
Multiple conditions are separated with Spaces or line breaks are available, and regular support, support, the following conditions / ^ (m b | | | | I h c | d | h) :
-
M: PATTERN: Pattern is a string or regular expression, and the matching request method contains either the string (case insensitive) or the request matching the regular
-
I: IP: IP indicates the client IP address or regular expression. The matching client IP address contains the string (case insensitive) or the request matching the regular
-
H :header :header indicates a part of the rawData character or regular expression in the request header. The matching request header contains the string (case insensitive) or the request matching the re.
The filter type field uses H, for example, H: CSS To filter CSS requests
-
H:host :host indicates the host field in the Network, adding the port to the domain name of the request. The host field of the matching request contains the string (case insensitive) or the request matching the re
-
Other: re or plain string, matching requests whose URLS contain the string (case insensitive) or match the re
The host \ URL field can be used to filter keywords directly
You can quickly Filter requests for the current URL or Host by right-clicking Filter -> This URL or This Host
More and more
Whistle Chinese Document