back-port base-uri updates from master to pull uri from Host header

This PR not for merging as we'll keep on this branch for the short term, but just for review/feedback

@seth @hosh @manderson26 @oferrigni @sdelano