Giter Site home page Giter Site logo

heskew / therealyou Goto Github PK

View Code? Open in Web Editor NEW

This project forked from briandela/therealyou

0.0 2.0 0.0 6 KB

hapi.js plugin for setting the request.info.remoteAddress and request.info.remotePort based on the X-Forwarded-For and X-Forwarded-Port headers

License: MIT License

JavaScript 100.00%

therealyou's Introduction

therealyou

Build Status Coverage Status npm version Dependencies Up To Date

hapi.js plugin for setting the request.info.remoteAddress and request.info.remotePort based on the X-Forwarded-For and X-Forwarded-Port headers

X-Forwarded-For

see: https://en.wikipedia.org/wiki/X-Forwarded-For

The general format of the x-forwarded-for header is:

X-Forwarded-For: client, proxy1, proxy2

This plugin sets request.info.remoteAddress to the first value of the x-forwarded-for header if it is set.

For example, if the header was

'x-forwarded-for': '192.16.184.5, 192.16.184.6, 192.16.184.2'

then remote.info.remoteAddress would be set to 192.16.184.5

X-Forwarded-Port

This plugin sets request.info.remotePort to the value of the x-forwarded-port header

Usage

const Hapi = require('hapi');

const server = new Hapi.Server();
server.connection();

server.register(require('therealyou'), function (err) {

    // Assuming no err, start server

    server.start(function () {
        // ..
    });
});

License

MIT

therealyou's People

Contributors

briandela avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.