Socket
Socket
Sign inDemoInstall

req-real-ip

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    req-real-ip

This library allows you to get the real ip address of a user. It gives you the real ip address even if the request header is modified.


Version published
Maintainers
1
Install size
13.7 kB
Created

Readme

Source

REQ REAL IP

This library allows you to get the real ip address of a user. It gives you the real ip address even if the request header is modified.

image

Usage

const app = require('express')();

app.listen(3000, () => { console.log('Server is running') });

const realip = require('req-real-ip')

app.use((req, res, next) => {
    res.json({
        user_ip: realip.detect({ 
            req: req, 
            config: { cloudflare: false } 
        })
    })
})

cloudflare If you are using Cloudflare, the ip address is sent in the cf-connecting-ip variable in the header. However, if Cloudflare is not used, the request can be manipulated by changing the header information. For this reason, if you are not using Cloudflare, you should send false.

Keywords

FAQs

Last updated on 14 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc