javascript - Nodejs, Express - Trying to get client IP from request object - shows 127.0.0.1 - Stack Overflow
- javascript - Node.js, vs. Electron:: Run external command and show the stdout on interface - Stack Overflow 推荐度:
- javascript - Nodejs, Express - Trying to get client IP from request object - shows 127.0.0.1 - Stack Overflow 推荐度:
- javascript - Node.js, express, and object instantiation insideoutside route endpoints - Stack Overflow 推荐度:
- javascript - NodeJS, MongoDB, Mongoose Save Large Data Non-Blocking - Stack Overflow 推荐度:
- 相关推荐
I'm connecting to my app, which is running on an AWS EC2 instance. I'm trying to get the client IP address but it is showing up as 127.0.0.1
I've tried retrieving it with both req.ip
and req.connection.remoteAddress
. Is there a way to get the IP address that's not the localhost IP?
I'm connecting to my app, which is running on an AWS EC2 instance. I'm trying to get the client IP address but it is showing up as 127.0.0.1
I've tried retrieving it with both req.ip
and req.connection.remoteAddress
. Is there a way to get the IP address that's not the localhost IP?
- stackoverflow./questions/19266329/node-js-get-clients-ip I think this guy asked the same question – AzaFromKaza Commented Jan 28, 2015 at 7:02
1 Answer
Reset to default 7If you're proxying requests through something like Nginx, then you can configure express to respect the X-Forwarded-For
header when getting req.ip
:
app.set('trust proxy', 'loopback');
http://expressjs./api.html#app.set
- 能跑安卓的锐龙3000C原来是它!热设计功耗低至4.5W
- 导航APP软件免费“醉翁之意不在酒”
- 力压谷歌、苹果,微软凭什么成为软件霸主?
- 评论:Android - 谷歌的一剂药-搜狐滚动
- Intel毫不客气:ARM+Win8软硬件都不行
- 云计算是新的商业基础设施
- 奇虎起诉腾讯:“中国互联网反垄断第一案”今日开庭
- visual c++ - MSVC errors out: undeclared identifier for SQL Server - Stack Overflow
- Makefile: Execute target multiple times - Stack Overflow
- VS Code extension for collapsing sub-folders - Stack Overflow
- html - Images not displaying in Django webapp deployed on Vercel - Stack Overflow
- flutter - How to adjust code formatting when formatting the document - Stack Overflow
- c# - Trouble when setting up Serilog in ASP.NET Core Web API - Stack Overflow
- sockets - PICO WMicropython websocket client can't send to PHP websocket properly - Stack Overflow
- Generic Trait Parameters in Rust - Stack Overflow
- python - Problem clearing errorbar artists from dynamic matplotlib figure - Stack Overflow
- https - ASP.NET app is not listening on port 5001 after deployment - Stack Overflow