20

I have a VPN connection on which I'm testing some websites using Charles Web Debugging Proxy, but Charles doesn't seem to detect my VPN connection because it doesn't detect the websites that I'm running on the VPN network. Any help please?

Thank you

user765368
  • 19,590
  • 27
  • 96
  • 167
  • Possible duplicate of https://stackoverflow.com/questions/25697849/charles-proxy-not-working-with-chrome This [answer](https://stackoverflow.com/a/73621526/816213) might help -- https://stackoverflow.com/a/73621526/816213 – gautamprajapati Sep 06 '22 at 11:57

6 Answers6

13

I had the same problem on my Mac but was able to solve it. Essentially after connecting to VPN Charles would stop recording all http traffic regardless of whether it was started before or after VPN connection was established

The problem was with Auto Proxy configuration at the system level.

I had Auto Proxy Config and Automatic Proxy Configuration turned ON in System Preferences> Network Settings>You network>Advanced

I was not able to turn them off via UI because they were disabled/greyed out by the corporate policy on the VPN machine but I was able to run 2 shell commands from the terminal though which turned both options OFF before starting Charles and before connecting to VPN (you will need admin access on your account to run these I suppose).

networksetup -setautoproxystate Wi-Fi off
networksetup -setproxyautodiscovery Wi-Fi off

Wi-Fi happens to be the name of the network interface I am running. If you are hard wired, yours could be Ethernet.

This essentially unticked both options in Network Settings leaving the URL for auto proxy intact. If you can untick these 2 checkboxes via the UI - even better.

Great so far but you aren't done yet!!

You need to figure out the true IP address of your corporate proxy and enter it under External Proxy Settings in Charles. Your VPN configuration might be pointing to an external configuration file. When you uncheck "Automatic Proxy configuration", the URL with the configuration should show in the "Proxy Configuration File" text box. Download that file, find the proxy setting, and enter those in the External Proxy Settings in Charles.

Voila - start Charles, start VPN - all HTTP traffic is flowing through Charles even when I am on VPN - precisely what I needed.

Hope this helps and you are running this on a MAC :)

Matt H
  • 6,422
  • 2
  • 28
  • 32
Franek Kuciapa
  • 141
  • 1
  • 8
  • 8
    mine are already unchecked... but still not working in yosemite – thecodejack Jan 30 '15 at 06:57
  • @MattH you say: _Download that file, find the proxy setting, and enter those in the External Proxy Settings in Charles._ However, my `.pac` file has quite complex and dynamic logic in it, which makes it impossible to find proxy settings. Is there a way to point Charles to URL with `.pac` which would then execute the `FindProxyForURL` function and figure out the proper proxy on the fly? – pprochazka72 Oct 15 '17 at 14:43
  • @pprochazka72 I don't know of a way to do that. The `.pac` I have is also quite complex and took a while for me to figure out which settings I had to use. – Matt H Oct 16 '17 at 15:05
11

For Viscosity:

Add this

dhcp-option HTTPPROXY 127.0.0.1:8888
dhcp-option HTTPSPROXY 127.0.0.1:8888

in the connection settings, under the tab "Advanced".

Charles will now work with Viscosity :)

enguerran
  • 305
  • 4
  • 9
  • Thanks - this enabled me to see web traffic in Charles when using Viscosity for a corporate VPN, when previously Charles would not see it. – tripRev Jun 29 '17 at 13:00
  • Out of all the suggestions I've tried, this one actually works. Small side note: it will only work when Charles is running. Also, the text disappears from the advanced tab after saving (it's still present in the connection's config file though), so it's difficult to remove. I'd recommend duplicating your connection before adding this. – nickiaconis Feb 21 '19 at 01:05
6

Start Charles before connecting to your vpn. http://www.charlesproxy.com/documentation/faqs/vpn-not-working-with-charles/

Clintm
  • 4,505
  • 3
  • 41
  • 54
3

Charles proxy and Tunnel Bear

1. run Charles
2. Charles -> Proxy -> MacOS Proxy
3. Charles -> Stop Recording
4. Charles -> Stop SSL Proxying 

5. run Tunnel Bear

6. Charles -> Start Recording
7. Charles -> Start SSL Proxying 
yoAlex5
  • 29,217
  • 8
  • 193
  • 205
1

Using Chrome and Viscosity as my VPN client, I'm unable to get any traffic from Chrome to go through Charles while the VPN is connected.

My solution is to use Firefox. It's probably because Firefox makes its own proxy connections (and therefore has its own proxy settings), while Chrome and Safari defer to MacOS to make the HTTP connection.

Robin Daugherty
  • 7,115
  • 4
  • 45
  • 59
  • 1
    This works - just remember to activate Charles to use Firefox proxy - ```Go to Charles, open Proxy menu, select `Mozilla Firefox Proxy``` Great, no more switching VPN on and off to test code changes! – Yorick Apr 27 '16 at 15:40
0

I managed to work Charles with my VPN with the next settings:

  1. Open charles -> Help -> SSL Proxying -> "Install Charles Root certificates on Mobile Device Or Remote Browser". This should show a dialog with proxy IP and port
  2. Open "System Preferences" -> Network. Select your VPN and press "Advenced"
  3. Go to "Proxies", and do the next for "Web Proxy", "Secure Web Proxy" and "SOCKS Proxy":
    • check the checkbox
    • for "web proxy server" enter "127.0.0.1"
    • for port enter the port from Charles Help dialog

It should work till VPN and Charles is running. After relaunch VPN or Charles you may change settings again. Not the best solution, but at least it works.