How to config local proxy for WP?

Hi, I tried Local today, it’s really awesome, REALLY. I even want to migrate all my wp sites from MAMP Pro to Local ASAP, actually I did it, but soon I realized that there is big problem for me personally.

I’m living in China, as you known, we can’t access some websites like Youtube without VPN, so I’ve been using a paid VPN app to jump the great firewall all the time.

and to make local wp sites able to connect to these blocked sites (e.g. using wp_remote_get() to get youtube data api) , I have to config proxy setting in wp-confg.php like this:

define(‘WP_PROXY_HOST’, ‘127.0.0.1’);
define(‘WP_PROXY_PORT’, ‘9743’);

The VPN I’m using is a Mac only app, there is no vpn-server address provided. Obviously, these settings can working with MAMP, but will not working on WP sites created by Local as they are in virtual env.

So, is there a way to solve this problem?

Hey there,

Glad you’re liking it!

One thing you could try is changing the WP_PROXY_HOST to the host machine (your Mac or PC) IP from the container.

You can get this IP by right-clicking on the site in Local then going to Open Site SSH. After the Terminal opens enter /sbin/ip route|awk '/default/ { print $3 }' and it will return the IP you need.

This may not work due to ports not being available to the container but it’s worth a shot.

Hello Clay

Iam having trouble bringing up the site when I am behind a proxy. I tried Open Site SSH and it gave me error

Tunnel or SSL Forbidden logout (on VPN)
proxyconnect tcp: dial tcp: lookup proxy.proxysherwin.com: no such host (Home Network)

At work if I turn off wifi the site works.
At home I don’t need to turn off wifi to make it work.

Iam trying to understand what is the setting i need to have if I content from youtube hosted on my site.

Thank You
Aruna