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?


3 Answers 3


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! Commented Dec 19, 2014 at 20:24

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.


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/


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .