Home

Awesome

cloudflare-detect Last version NPM Status github actions status

Detect whether a site is running behind Cloudflare.

Install

npm install --save cloudflare-detect

Note that versions > 2 of this package are ESM-only. Use 1.x for CommonJS support.

Usage

const cloudflareDetect = require('cloudflare-detect');

cloudflareDetect('nikolaskama.me').then(cf => {
	console.log(cf);
	//=> true
});

cloudflareDetect('google.com').then(cf => {
	console.log(cf);
	//=> false
});

API

cloudflareDetect(targets, [options])

Returns a Promise for a boolean which is true if any of the targets are running behind Cloudflare.

targets

Type: string Array

One or more targets to check. Can either be a full URL like https://hostname or just hostname. When the protocol is missing from a target http is assumed.

options

timeout

Type: number

Timeout in milliseconds after which a request is considered failed. Default: 5000.

Credits

Contributors

License

MIT © Nikolaos Kamarinakis