This article will discuss how to use Clash (Clash.Meta
core) along with Fiddler Everywhere (v6.0.0
) to perform global network debugging.
Processes
Enable Clash TUN Mode
This should be the most important step, by enabling TUN mode in Clash, we could make sure all requests will go through Clash.
There are different Clash Frontend, you may want to check out corresponding docs about how to enable TUN mode using your frontend.
Set Fiddler Listening Port
The next step we need to do is to make sure Fiddler is set to actively listening a specific port. At default, fiddler listening on:
127.0.0.1:8866
Forward Request To Fiddler
Now all things are ready, all we need to do is to use the Clash functionality, set the rules to make all the request we want to inspect to be forwarded from Clash to Fiddler.
First, we could create a new HTTP
proxy node called Fiddler
:
prepend:
- type: 'http'
name: 'Fiddler'
server: '127.0.0.1'
port: 8866
Then, we could add rules to forward specific request to fiddler by adding new rules to the config file:
# In Clash.Meta, prepend rules settings file.
prepend:
- 'PROCESS-NAME-REGEX,.*MuMu.*,Fiddler'
- 'PROCESS-NAME, msedge.exe, Fiddler'
Now all is done, you could start using Fiddler to inspect the request.
Set Proxy Group
This is optional, however, recommended, when using this approach.
When using the settings above, the request will still be forwarded to the Fiddler proxy even if we don't need to inspect the flow and the Fiddler is closed. This could cause request failed when Fiddler is not open and listening.
Instead of use the proxy node Fiddler
directly, we may want to create a new proxy group like the one below:
prepend:
- type: 'select'
name: 'Fiddler Group'
... # other configs
proxies:
- 'Fiddler'
- 'Manual Select Group'
In this case, when we no longer need to inspect the network and close the Fiddler application, we could just redirect the request to other proxies or other proxy groups.
Data Flow
At the first glance, you may think the specified request data which being forwarded to Fiddler will go through something like this:
stateDiagram-v2
state "Applications" as app
state "Clash" as clash
state "Fiddler" as fdlr
state "Internet" as net
app --> clash: TUN Mode, all requests being caught
clash --> fdlr: Specified parts of requests using Rules
fdlr --> net
clash --> net: Other unspecified requests.
classDef st_internet font-weight:bold,fill:#08fd,color:#fff,stroke-width:0px
classDef st_app font-weight:bold,fill:#f80d,color:#fff,stroke-width:0px
class net st_internet
class app st_app
However, one thing that we need to keep in mind is that: Fiddler is also an application, which's requests could be proxied by Clash TUN services. So the actual diagram should be like the one below:
stateDiagram-v2
state "Applications" as app
state "Clash" as clash
state "Fiddler" as fdlr
state "Internet" as net
app --> clash: TUN Mode<br>all requests being caught
clash --> fdlr: Specified requests<br>using rules.
fdlr --> clash: Re-proxied by<br>Clash TUN.
clash --> net: Other<br>unspecified requests.
classDef st_internet font-weight:bold,fill:#08fd,color:#fff,stroke-width:0px
classDef st_app font-weight:bold,fill:#f80d,color:#fff,stroke-width:0px
class net st_internet
class app st_app
No comment