The list of CloudFlare IPs (IP ranges) to be used in the "trust proxy" configurations.
npm install cloudflare-ips


The list of [CloudFlare][cloudflare] IPs (IP ranges) to be used in the [trust proxy][proxy]
configurations.
``bashyarn add cloudflare-ips
$ npm install cloudflare-ips # or, `
`js
const express = require('express');
const cloudflareIPs = require('cloudflare-ips');
const app = express();
cloudflareIPs(
ips => app.set('trust proxy', ['loopback', ...ips]),
err => console.error(err.stack),
);
cloudflareIPs((err, ips) => {
app.set('trust proxy', ['loopback', ...ips]);
});
app.listen(8080);
`
#### cloudFlareIPs(onUpdate, onError, options)
* onUpdate: (ips: string[]) => void — a callback function accepting the list of IPsonError
* : (err: Error) => void — a callback that is triggered on error (optional)options
* : { inteval: number }` — allows to tweak the default settings (optional)
* [Node.js API Starter Kit][nsk] — Boilerplate and tooling for building data APIs with Docker,
Node.js and GraphQL
Copyright © 2017-present [Kriasoft][kriasoft]. This source code is licensed under the MIT license
found in the [LICENSE.txt][license] file.
---
Made with ♥ by Konstantin Tarkus (@koistya, blog)
[cloudflare]: https://www.cloudflare.com/
[proxy]: https://expressjs.com/en/guide/behind-proxies.html
[nsk]: https://github.com/kriasoft/nodejs-api-starter
[kriasoft]: https://www.kriasoft.com/
[license]: https://github.com/kriasoft/cloudflare-ips/blob/master/LICENSE.txt