modify token url logic

better handling for situations where the request to be proxied is
pointing at a Portal Url that doesn't include '/rest/'

removed explicit references to the 'proxy.config'