How to use X-Forwarded-Proto in plone and still let VHM mapping direct to the right root

I've asked this here but I'll try here also

I am running behind a CDN that turns my https request into http and sets X-Forwarded-Proto.

I know in nginx I can create a rule that rewrites my request as localhost:8080/VirtualRequestBase/https/realsite.com:80/VirtualHostRoot/siteroot so that urls come out right.

However I have a zope setup where I keep many sites and I don't want to have to change the nginx config every time I add a new one. I normally use the VHM mappings tab to map domains to siteroots, however it will ignore the VirtualHostBase directive in the path. In addition you can mix the two styles of VHM, ie set localhost:8080/VirtualRequestBase/https/realsite.com:80 and expect it use the mappings.

@djay,
Firstly I believe it should be:
VirtualHostBase instead of VirtualRequestBase (not familiar with VirtualRequestBase)
and 443 instead of 80

localhost:8080/VirtualHostBase/https/realsite.com:443/VirtualHostRoot/siteroot ...?

I've had some success doing something similar with virtual_hosting see notes here:

Thats strange. What version of plone are you using? I tested this and confirmed that the code ignores virtualhostbase in mappings tab in plone 4.3. I will recheck it.