---
title: "Discussion on \"How to Get a Visitor’s IP and Country in Express (Behind Proxies and CDNs)\" | Hashnode"
description: "Discussion on \"How to Get a Visitor’s IP and Country in Express (Behind Proxies and CDNs)\". Fix req.ip behind Nginx, load balancers and CDNs, skip the spoofable X-Forwarded-For pattern, and add a cached, fail-open country lookup with an honest accuracy radius.\nWhy req.ip shows your proxy’s I"
url: "https://hashnode.com/posts/how-to-get-a-visitor-s-ip-and-country-in-express-behind-proxies-and-cdns/6ac7e57f1ab4173f90651cd8"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Get a Visitor’s IP and Country in Express (Behind Proxies and CDNs)](https://networkdatalabs.hashnode.dev/how-to-get-a-visitor-s-ip-and-country-in-express-behind-proxies-and-cdns?utm_source=hashnode&utm_medium=feed)

Fix req.ip behind Nginx, load balancers and CDNs, skip the spoofable X-Forwarded-For pattern, and add a cached, fail-open country lookup with an honest accuracy radius. Why req.ip shows your proxy’s I

Oct 8 · 7 min read · networkdatalabs.hashnode.dev  
Updated Oct 9  
Read the article

-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#expressjs](https://hashnode.com/tag/expressjs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#security](https://hashnode.com/tag/security)

## Written by

[Network Data Labs](https://hashnode.com/@networkdatalabs)

@networkdatalabs

  
[View profile](https://hashnode.com/@networkdatalabs)

IP geolocation API with ASN, timezone and risk signals (Tor, hosting, known VPN networks). Free plan: 1,000 requests/day. Docs in English and Spanish.

IP geolocation API with ASN, timezone and risk signals (Tor, hosting, known VPN networks). Free plan: 1,000 requests/day. Docs in English and Spanish.

## Responses 1

Markdown supported · ⌘↵ to post

No responses yet.
