Fiddler not intercepting PowerShell web requests
Fiddler actually works via a proxy, and automatically sets proxy settings in IE when running. You can check this by launching fiddler and then checking "Lan Settings" under Internet Options > Connection.
Invoke-RestMethod
has a -Proxy
parameter you can use to point to Fiddler's proxy. I think the default is 127.0.0.1:8888 :
Invoke-RestMethod -Proxy 'http://127.0.0.1:8888' ....
Edit: Adding screenshot to confirm the answer above.
I had a similar issue (with Powershell & Fiddler2 ) while installing NPM packages.
It worked after setting up Fiddler as a Reverse Proxy then using the command mentioned in the answer here (thanks for that JNK).
Step-by-step instructions below:
- Follow the steps mentioned here and write the one line FiddlerScript Rule to use Fiddler as a Reverse Proxy.
In my case it was:
if (oSession.host.toLowerCase() == "127.0.0.1:8888") oSession.host = "127.0.0.1:80";
- Then in PowerShell use the configured proxy settings:
PS F:> npm install yo -g -proxy 'http://127.0.0.1:8888'
- Now the PowerShell traffic should flow through Fiddler.