Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cloudflare-ips

kriasoft1.8kMIT0.3.0

The list of CloudFlare IPs (IP ranges) to be used in the "trust proxy" configurations.

cloudflare, cloudflare ips, cloudflare-ips, proxy, trust proxy, trust-proxy, ip, ips, express, expressjs, express.js

readme

CloudFlare IP Ranges

build status npm version npm downloads

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 IPs
  • onError: (err: Error) => void — a callback that is triggered on error (optional)
  • options: { inteval: number } — allows to tweak the default settings (optional)

License

Copyright © 2017-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE.txt file.


Made with ♥ by Konstantin Tarkus (@koistya, blog)