May 022012
 

Had to look up the outgoing IP from a server today. To my surprise the usual curl request to http://whatismyipaddress.com/  failed with the following:

[@sphere: ~]$ curl "http://whatismyipaddress.com/"
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <html><head>
 <title>403 Forbidden</title>
 </head><body>
 <h1>Forbidden</h1>
 <p>You don't have permission to access /
 on this server.</p>
 <p>Additionally, a 500 Internal Server Error
 error was encountered while trying to use an ErrorDocument to handle the request.</p>
 </body></html>

Didn’t expect a plain curl would cause a 500. 🙂

So I ended up with the follwing small CGI script, which output can be seen under ip.ps-xaf.de

#!/usr/bin/perl -w
use CGI;
my $q = new CGI;
print $q->header;
print $q->remote_addr . "\n";
exit;

 
 

Sorry, the comment form is closed at this time.