REST API & href attributes in relational links

I’m currently Python scripting some Confluence to XWiki migration tools and I noticed that the href attributes in the relational links provided by the API contain the hostname as configured in the PTR in the reverse zone according to its local IP address.

If my XWiki is on xwiki-backend.example.com and I use a reverse proxy xwiki.example.com to curl the API, this is the result:

curl -u "user:password" "http://xwiki.example.com/xwiki/rest/wikis/xwiki/spaces/Help/spaces/" | xmllint --format -
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<space xmlns="http://www.xwiki.org">
  <link href="http://xwiki-backend.example.com:8080/xwiki/rest/wikis/xwiki/spaces/Help/pages" rel="http://www.xwiki.org/rel/pages"/>
  <link href="http://xwiki-backend.example.com:8080/xwiki/rest/wikis/xwiki/spaces/Help/pages/WebHome" rel="http://www.xwiki.org/rel/home"/>
  <link href="http://xwiki-backend.example.com:8080/xwiki/rest/wikis/xwiki/spaces/Help/search" rel="http://www.xwiki.org/rel/search"/>
  <id>xwiki:Help</id>
  <wiki>xwiki</wiki>
  <name>Help</name>
  <home>xwiki:Help.WebHome</home>
  <xwikiRelativeUrl>http://xwiki.example.com/xwiki/bin/view/Help/</xwikiRelativeUrl>
  <xwikiAbsoluteUrl>http://xwiki.example.com/xwiki/bin/view/Help/</xwikiAbsoluteUrl>
</space>

Besides the cosmetic issues with that, it’s plain wrong to not use the obviously correctly detected hostname xwiki.example.com, as the xwiki-backend host might only be reachable by the reverse proxy server.