10

I have YouTube blocked at my work because reasons.

I’m a scientist and I need YouTube because most of the conferences and talks that I’d like to see are available there. Yes, I actually need YouTube, for science.

I spoke to the network admin at my school here, but he's kind of hard to deal with and doesn’t understand any reasoning. He’s the kind of guy that thinks that the Internet somehow goes through fixed channels and ports and that it is actually possible to block stuff like access to YouTube.

Anyway, fortunately I have a dedicated server somewhere so I can ssh-proxy there like this:

ssh -D 5000 -CN myself@myserver

And then configure Firefox (yes, Firefox, because Chrome is lazy and just relies on OS X settings [yes, I'm on OS X]) to use a SOCKS5 proxy to that port and pretty much have all the Internet I want.

Since the Internet here is pretty cool I don’t have any noticeable latency or bandwith problems.

Thing is that my dedicated server charges me for the bandwidth and I have to turn everything off in order to download some big files (which I also need, because science). So, since I don’t want to be turning on and off this thing each time I want to see a youtube video, I’d like to somehow tell Firefox (or my computer) to just route youtube.com through the SOCKS5 proxy. I see that it can be easily done the other way around (i.e. send all traffic through the proxy if they are NOT for these domains), but I don’t know how the designers didn't thought of the opposite case.

Does someone know of a simple way to achieve this?

11

You can create a Proxy AutoConfiguration (PAC) file for Firefox, and configure it under "Automatic Proxy Configuration URL" (either putting the PAC file online somewhere on a HTTP server, or by using a file:///path/to/file.pac-style URL).

The PAC file itself is a text file (JavaScript) defining a function that determines which proxy to use:

function FindProxyForURL(url, host)
{
  if (shExpMatch(url, "*.youtube.com/*")) {
    return "SOCKS localhost:5000";
  } else {
    return "DIRECT";
  }
}

This is a simple example that should suit your needs, but with PAC it is possible to define very complex proxy schemes (e.g., taking time of day in account, having several proxies, depending on the local IP address, etc.). You can easily find more info about PAC files on the Internet, e.g. http://findproxyforurl.com/pac-functions/.

  • sweeeeeeeeeeet! – almosnow Dec 19 '14 at 20:24
3

I don't know about Firefox, but on Chrome I use the extension Proxy SwitchySharp (https://chrome.google.com/webstore/detail/proxy-switchysharp/dpplabbmogkhghncfbfdeeokoefdjegm, take a look on the third screen on that site), where I can create rules.

With this, you can create a rule where the domain youtube.com use the configured proxy, and all other sites do not use any proxy.

1

If you want to go through a proxy only for certain domains then an extension can make the choice through a pattern. For example *youtube* and whatever else the domains that they use are. FoxyProxy does it https://addons.mozilla.org/en-us/firefox/addon/foxyproxy-standard/

  • '"I have to turn everything off" -what do you mean?' I removed that. That's s comment that should be posted as a comment on the question. Not as part of an answer. – JakeGould Mar 12 '15 at 0:14

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.