CloudFlare IP Ranges
The list of CloudFlare IPs (IP ranges) to be used in the trust proxy configurations.
How to Use
$ npm install cloudflare-ips # or, `yarn add cloudflare-ips`
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);
API
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)
Related Projects
- Node.js API Starter Kit — Boilerplate and tooling for building data APIs with Docker, Node.js and GraphQL
License
Copyright © 2017-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE.txt file.