In the past, I've used plugins to do just what you ask. FoxyProxy Standard did the trick (it looks like there's now at least another more standard "VPN" version, too). It looks like Firefox does have support for Native PAC files that'll also do the trick:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Pro...