This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// early experiments with node had mysterious double requests | |
// turned out these were for the stoopid favicon | |
// here's how to short-circuit those requests | |
// and stop seeing 404 errors in your client console | |
var http = require('http'); | |
http.createServer(function (q, r) { | |
// control for favicon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getIP(req) { | |
var ip_address = (req.connection.remoteAddress ? req.connection.remoteAddress : req.remoteAddress); | |
//check for cloudflare | |
try { | |
if (req.headers['cf-connecting-ip']) { | |
var ipParts = ip_address.split("."); | |
var cloudFlare = false; | |
switch (parseInt(ipParts[0])) { | |
case 204: | |
//(204.93.177.0 - 204.93.177.255) |