Don't run this on EC2; you'll probably get your metadata stolen. Also:
if (!validUrl.isUri(url)) { // Also protects against file://...
It does? ▶ cat valid.js
var validUrl = require('valid-url');
if (validUrl.isUri("file:///etc/passwd")){
console.log('Looks like a URI');
}
▶ node valid.js
Looks like a URI
Perhaps the problem requires a little more than 15 minutes to do well :)