Skip to content

Instantly share code, notes, and snippets.

@bithive
Created June 17, 2013 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bithive/5800101 to your computer and use it in GitHub Desktop.
Save bithive/5800101 to your computer and use it in GitHub Desktop.
Perl module for nginx which displays the value of REMOTE_ADDR
package ip;
use nginx;
sub handler {
my $r = shift;
my $ip = $r->remote_addr;
$r->send_http_header("text/html");
$reply = <<END;
<html>
<head>
<meta name="googlebot" content="noindex"/>
<title>$ip</title>
<style type="text/css">
td { font-size: 5em; }
</style>
</head>
<body>
<table width="100%" height="100%">
<tr><td align="center" valign="middle">$ip</td></tr>
</table>
</body>
</html>
END
$r->print($reply);
$r->rflush;
return OK;
}
1;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment