Redirect web traffic (SOCKS proxy) for a specific domain
Solution 1:
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/.
Solution 2:
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.