Skip to content

Provides `request.remoteAddress` with support for `X-Forwarded-For` headers.

Notifications You must be signed in to change notification settings

jedireza/hapi-remote-address

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hapi-remote-address

Provides request.remoteAddress with support for X-Forwarded-For headers.

Build Status Dependency Status Peer Dependency Status Dev Dependency Status

Install

$ npm install hapi-remote-address

Usage

Register the plugin:

const Hapi = require('hapi');
const HapiRemoteAddress = require('hapi-remote-address');

const main = async function () {
    const server = Hapi.Server();

    await server.register(HapiRemoteAddress);

    // ...

    await server.start();

    console.log(`Server is listening at ${server.info.uri}`);
};

main();

Then in your route handlers you have access to request.remoteAddress.

License

MIT

Don't forget

What you create with hapi-remote-address is more important than hapi-remote-address.

About

Provides `request.remoteAddress` with support for `X-Forwarded-For` headers.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published