I used the following code:
my $server_addr = inet_ntoa(scalar gethostbyname(hostname() || 'localhost')); my $call_addr = $query->remote_addr(); die unless $call_addr eq "127.0.0.1" || $call_addr eq $server_addr;
I don't think it covers all cases, but it seems to work with my setup. If someone knows a general solution, post it here.
source share