Skip to content

Cannot determine client's IP address #21

@vporton

Description

@vporton

"For the unique (and live) visitor functionality to work properly, each request must have the User-Agent and X-Client-IP-Address HTTP headers set. If you don't set these headers, the API will still work, but the unique visitor count will be incorrect."

X-Client-IP-Address is non-standard. Browsers don't provide it.

You can use this instruction how to get IP address (when there is no X-Client-IP-Address) if you don't know how. Particularly, you can write code like:

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

app.get('/get-ip', (req, res) => {
    const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
    res.json({ ip });
});

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions