Currently, the configuration of autodiscover uses the hostname "localhost" in its value of SERVERURL. This is almost certainly incorrect. I was wondering if it is possible to use the value of $_SERVER['HTTP_HOST'] as default value instead? That would at least work by default in more cases.
I was thinking about something along the lines of
but of course the separate variable isn't really necessary. And of course there are other options as well: provide an empty value in the config file and use the above default if the value is empty. This is a matter of preference.
Providing a more useful default like this will help in getting easy-to-use packages.
I can provide a patch if anyone's interested.