back ported changes for more flexible proxying
Merge remote-tracking branch 'origin/master'