Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

forwarded-http

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forwarded-http - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

4

lib/middleware.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc