ServerName
também aceita um esquema, por exemplo %código%. Mudar isso na configuração e reiniciar o Apache resolveu o problema.
De a documentação :
Sometimes, the server runs behind a device that processes SSL, such as a reverse proxy, load balancer or SSL offload appliance. When this is the case, specify the
https://
scheme and the port number to which the clients connect in theServerName
directive to make sure that the server generates the correct self-referential URLs.