One of my colleagues solved the issue. He adapted the JcrResourceResolverFactoryImpl config file and sling mappings.
org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.config
resource.resolver.required.providernames=["JCR"]
resource.resolver.manglenamespaces=B"true"
resource.resolver.optimize.alias.resolution=B"true"
resource.resolver.vanitypath.blacklist=["/content/usergenerated"]
resource.resolver.vanity.precedence=B"false"
resource.resolver.vanitypath.maxEntries=I"-1"
resource.resolver.required.providers=[""]
resource.resolver.enable.vanitypath=B"true"
resource.resolver.providerhandling.paranoid=B"false"
resource.resolver.allowDirect=B"true"
resource.resolver.mapping=["/-/"]
resource.resolver.vanitypath.whitelist=["/apps/","/libs/","/content/"]
resource.resolver.map.location="/etc/map"
resource.resolver.vanitypath.maxEntries.startup=B"true"
resource.resolver.map.observation=["/"]
resource.resolver.default.vanity.redirect.status=I"302"
resource.resolver.vanitypath.bloomfilter.maxBytes=I"1024000"
resource.resolver.searchpath=["/apps","/libs"]
resource.resolver.log.unclosed=B"false"
resource.resolver.log.closing=B"false"
resource.resolver.virtual=[
"https://www.brand.com:/content/brand",
"https://retailer.brand.com/:/content/brand/retailers/retailer"
]
ui.apps/src/main/content/jcr_root/etc/map.prod/https/retailer.brand.com.443/.content.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Mapping"
sling:match="content/brand/retailers/retailer(.*)"
sling:internalRedirect="[/content/brand/retailers/retailer$1]"/>
ui.apps/src/main/content/jcr_root/etc/map.prod/https/retailer.brand.com.443/content/.content.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Mapping"
sling:internalRedirect="[/content/brand/retailers/retailer]"/>