Skip to content
Bypass system proxy when connected to VPN
Got a problem with Viscosity or need help? Ask here!
Hi there,
I tested the software out and was pretty impressed by its stability and overall ease and registered a copy.
One problem though: in the past when I connected using PPTP in OS X, the built-in VPN was smart enough to bypass my system wide proxy. OpenVPN on iOS does that too. Is there a way to make Viscosity ignore my system proxy settings?
I tested the software out and was pretty impressed by its stability and overall ease and registered a copy.
One problem though: in the past when I connected using PPTP in OS X, the built-in VPN was smart enough to bypass my system wide proxy. OpenVPN on iOS does that too. Is there a way to make Viscosity ignore my system proxy settings?
Hi bedouin,
Viscosity can't turn off your proxy settings directly, however you can use Viscosity's AppleScript support to do so instead. The easiest way would be to create two scripts that use the "networksetup" command to toggle your proxy settings off when you connect, and back on when you disconnect.
Firstly, see this guide for information on how to write and use AppleScript scripts in Viscosity. Then you'll need to create your Connected and Disconnected scripts. For example, if you use a standard web proxy you'll want a Connected script that looks something like:
If you use a different type of proxy, or use multiple proxy types, you'll need to adjust or add commands accordingly. E.g. use "-setsecurewebproxystate" instead for a secure web proxy, "-setsocksfirewallproxystate" for a SOCKS proxy, etc.
Finally, networksetup may need to prompt you for admin rights to be able to make the change. If you wish to stop this behaviour you can run it directly from Viscosity with admin rights, for example:
James
Viscosity can't turn off your proxy settings directly, however you can use Viscosity's AppleScript support to do so instead. The easiest way would be to create two scripts that use the "networksetup" command to toggle your proxy settings off when you connect, and back on when you disconnect.
Firstly, see this guide for information on how to write and use AppleScript scripts in Viscosity. Then you'll need to create your Connected and Disconnected scripts. For example, if you use a standard web proxy you'll want a Connected script that looks something like:
Code: Select all
And a Disconnected script that looks something like:do shell script "networksetup -setwebproxystate 'Ethernet' off"
Code: Select all
You should change the "Ethernet" text to the name of your network adapter if it is something else. For example Ethernet is typically your wired network connection, while "Wi-Fi" is typically the name for your wireless connection.do shell script "networksetup -setwebproxystate 'Ethernet' on"
If you use a different type of proxy, or use multiple proxy types, you'll need to adjust or add commands accordingly. E.g. use "-setsecurewebproxystate" instead for a secure web proxy, "-setsocksfirewallproxystate" for a SOCKS proxy, etc.
Finally, networksetup may need to prompt you for admin rights to be able to make the change. If you wish to stop this behaviour you can run it directly from Viscosity with admin rights, for example:
Code: Select all
Cheers,do shell script "networksetup -setwebproxystate 'Ethernet' off" user name "username" password "password" with administrator privileges
James
Web: https://www.sparklabs.com
Support: https://www.sparklabs.com/support
Twitter: https://twitter.com/sparklabs
Support: https://www.sparklabs.com/support
Twitter: https://twitter.com/sparklabs
Thanks for your reply but I opted for a simpler solution: I connected the proxy itself to the VPN. Now all machines on my network can route traffic through it, and bypass my ISP's traffic shaping without violating my VPN provider's two machine limit. As an added perk I get caching and global adblocking, two things that can't hurt when connected through a VPN. Also my local network hostnames and domains remain resolvable.
There will still be cases where I want to use the VPN for more than just web traffic though, so Viscosity will still occupy a special place in my menu bar.
There will still be cases where I want to use the VPN for more than just web traffic though, so Viscosity will still occupy a special place in my menu bar.
3 posts
Page 1 of 1