Provides request.remoteAddress
with support for X-Forwarded-For
headers.
$ npm install hapi-remote-address
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
.
MIT
What you create with hapi-remote-address
is more important than hapi-remote-address
.