|
Living outside the UK, I was beginning to tire of messages like "the content you requested is not available in your country". Here's an easy, one-time fix for all machines on your LAN.
The solution? Simply setup an automatic proxy config script, your UK-based webserver and putty.
1) Setup and connect a SSH connection (I use Putty) to ssh to your UK based webserver and specify dynamic port forward from (in this case) local port 8123.
Replace bert:8123 with the name of your machine
Add or change UK_HOSTS to include the websites you want to proxy
3) Set your browser settings on machines on your LAN to use to use the new script.
4) Bask in the glory of being able to use iPlayer, Spotify and countless other services from outside the UK.
5) Append query string parameter for override and for debug
useProxy=true forces the current page to be proxied even if it's not in UK_HOSTS
debugProxy=true logs out which proxy was used
function FindProxyForURL(url, hostname) {
// Websites to proxy.
var UK_HOSTS = [
'bbc.co.uk',
'bbci.co.uk',
'bbcimage.co.uk',
'spotify.com',
'last.fm'];
var SSH_CLIENT = 'bert:8123';
var DIRECT = 'DIRECT';
var SOCKS_PROXY = 'SOCKS ' + SSH_CLIENT + ';' + DIRECT;
// Default to direct.
var proxy = DIRECT;
if (url.indexOf('useProxy=true') >= 0) {
// Use proxy if specified in URL e.g. www.somewebsite.com?useProxy
proxy = SOCKS_PROXY;
} else {
// See if the current website is on the proxy list.
for (var i=0, host; host = UK_HOSTS[i]; i++) {
if (shExpMatch(url, "*." + host + "/*")) {
proxy = SOCKS_PROXY;
break;
}
}
}
// Log some debug info out if requested.
if (url.indexOf('debugProxy=true') >= 0) {
// alert does not flash up a JS alert box but logs to the
// JS console in this case.
alert('Using ' + proxy + ' for url ' + url + ' with host ' + host);
}
return proxy;
}
|