Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kriasoft/cloudflare-ips
The list of CloudFlare IPs (IP ranges) to be used in the "trust proxy" (behind proxy) configurations
https://github.com/kriasoft/cloudflare-ips
cloudflare express express-js expressjs javascript koa koajs node node-js nodejs proxy proxy-list
Last synced: 3 months ago
JSON representation
The list of CloudFlare IPs (IP ranges) to be used in the "trust proxy" (behind proxy) configurations
- Host: GitHub
- URL: https://github.com/kriasoft/cloudflare-ips
- Owner: kriasoft
- License: mit
- Created: 2017-09-09T10:37:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-09T16:42:23.000Z (over 7 years ago)
- Last Synced: 2024-10-29T23:15:02.336Z (3 months ago)
- Topics: cloudflare, express, express-js, expressjs, javascript, koa, koajs, node, node-js, nodejs, proxy, proxy-list
- Language: JavaScript
- Homepage:
- Size: 38.1 KB
- Stars: 8
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# CloudFlare IP Ranges
[![build status](https://img.shields.io/travis/kriasoft/cloudflare-ips/master.svg?style=flat-square)](https://travis-ci.org/kriasoft/cloudflare-ips)
[![npm version](https://img.shields.io/npm/v/cloudflare-ips.svg?style=flat-square)](https://www.npmjs.com/package/cloudflare-ips)
[![npm downloads](https://img.shields.io/npm/dm/cloudflare-ips.svg?style=flat-square)](https://www.npmjs.com/package/cloudflare-ips)The list of **[CloudFlare][cloudflare]** IPs (IP ranges) to be used in the *[trust proxy][proxy]*
configurations.## How to Use
```bash
$ npm install cloudflare-ips # or, `yarn add cloudflare-ips`
``````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);
```## 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)## Related Projects
* [Node.js API Starter Kit][nsk] — Boilerplate and tooling for building data APIs with Docker,
Node.js and GraphQL## License
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](https://twitter.com/koistya), [blog](https://medium.com/@tarkus))[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