REVIEW: [NEXUS-6490] Calculate base url based on request headers

https://issues.sonatype.org/browse/NEXUS-6490