NEXUS-6277: Backporting the 2nd set of changes

That were applied to master PR after it was created
and the 2.7.x backport did not contain it.
Merge pull request #366 from sonatype/nexus-2.7.x-NEXUS-6277-router

[2.7.x] NEXUS-6277: Backporting the 2nd set of changes