Skip to content

zfcsoftware/real-ip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published