forwarded-http
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -5,5 +5,5 @@ 'use strict' | ||
module.exports = function () { | ||
module.exports = function (options) { | ||
return function middleware (req, res, next) { | ||
req.forwarded = forwarded(req) | ||
req.forwarded = forwarded(req, options) | ||
@@ -10,0 +10,0 @@ next() |
{ | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"name": "forwarded-http", | ||
@@ -4,0 +4,0 @@ "description": "Resolves RFC 7239 / Forwarded HTTP Extension, with fallback to all legacy & special Forward headers: `X-Forwarded-*`, `X-Real-*` and others", |
# Forwarded HTTP [![version][npm-version]][npm-url] [![License][npm-license]][license-url] | ||
Resolves [RFC 7239](https://tools.ietf.org/html/rfc7239) *(Forwarded HTTP Extension)*, with fallback to all legacy & special Forward headers: `X-Forwarded-*`, `X-Real-*`, `Fastly-Client-IP`, `X-Cluster-Client-IP`, and others. | ||
> Resolves [RFC 7239](https://tools.ietf.org/html/rfc7239) *(Forwarded HTTP Extension)*, with fallback to all legacy & special Forward headers: `X-Forwarded-*`, `X-Real-*`, `Fastly-Client-IP`, `X-Cluster-Client-IP`, and others. | ||
@@ -9,2 +9,4 @@ Focuses on resolving to the RFC standard and providing a consistent access to HTTP Forwarded Parameters: `by`, `for`, `host`, `proto`. | ||
Use as Express Middleware to populate `req.forwarded` object. | ||
[![Build Status][travis-image]][travis-url] | ||
@@ -35,2 +37,7 @@ [![Downloads][npm-downloads]][npm-url] | ||
}) | ||
// don't list private IPs | ||
var filteredParams = forwarded(req, { | ||
allowPrivate: false | ||
}) | ||
``` | ||
@@ -98,2 +105,24 @@ | ||
## Middleware | ||
Use as Express Middleware to populate `req.forwarded` object. | ||
### forwarded([options]) | ||
```js | ||
var express = require('express') | ||
var forwarded = require('forwarded-http/lib/middleware') | ||
var app = express() | ||
// use with default options | ||
app.use(forwarded()) | ||
// or with options | ||
app.use(forwarded(req, { | ||
filter: ['1.0.?.*', '2001:db8:*'], | ||
allowPrivate: false | ||
}) | ||
``` | ||
## Support | ||
@@ -100,0 +129,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13904
166