🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@shortcm/cloudfront-ip-ranges

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shortcm/cloudfront-ip-ranges

Get Cloudfront IPs for use in trust proxy configurations

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
2
Created
Source

Cloudfront IP ranges

npm npm Dependents (via libraries.io)

Get Cloudfront IPs for use in trust proxy configurations.

This package will be updated if Cloudfront ever decides to change the endpoints for retrieving current IPs. We will most likely never see a breaking change for this package.


Install

Requires node 8 or newer.

npm install --save cloudfront-ip-ranges

Usage

For use in an Express environment please see Express documentation on trust proxies.

It is recommended to use setInterval for updating the IP list periodically.

Directly update trust proxies for an Express app

const cfIPranges = require('cloudfront-ip-ranges')

cfIPranges.updateTrustProxy(app)

setInterval(() => {
  cfIPranges.updateTrustProxy(app)
}, 1000*60*60*12)

Getting a list of IPs and updating trust proxies manually

Useful if you need to list other proxies alongside the Cloudfront ones.

const cfIPranges = require('cloudfront-ip-ranges')

cfIPranges.updateIPs()
  .then((ips) => {
    app.set('trust proxy', ['loopback', ...ips])
  })

API

MethodInfo
getIpRangeBy default returns Promise<string[]>.
updateTrustProxyTakes an Express app instance as an argument. Returns Promise<void>.

Changelog

VersionRelease notes
0.1.0Initial release.

Keywords

cloudfront

FAQs

Package last updated on 01 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts