Subject: | HTTP::Daemon always resolves server hostname from IP |
HTTP::Daemon in sub url (aka $self->daemon->url) always resolves the IP
to a hostname, even if the IP was specified.
if (!$addr || $addr eq INADDR_ANY) {
require Sys::Hostname;
$url .= lc Sys::Hostname::hostname();
}
else {
$url .= gethostbyaddr($addr, AF_INET) || inet_ntoa($addr);
}
This is a problem because the server may be having the ports forwarded
to it from a firewall, ie the external address of the server may not be
the correct address for the clients to connect to.
This causes problems for instance in ->redirect if relative paths are
specified. It is possible to work around the problem by either
specifying full paths in redirects or by setting the server hostname to
be the IP of the external interface.
It would be better if HTTP::Daemon could simply make a check for a
config flag, before executing the block that resolves the hostname.
Or it could simply use whatever address is specified, if one has been
manually specified, not performing the lookup.
It seems safer that the default should be to not do the lookup, and that
reverse lookups should require a config flag.