The xwikiRelativeUrl property has been introduced by
XWIKI-3346 in XWiki 1.8. It's not easy to determine when we broke it but right now its value is an absolute URL. You can check with:
The issue seems to be related to the fact that ExternalServletURLFactory is put on the XWiki context and it always returns an absolute URL (as its name suggests).