Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

586
Views
nginx: how to get the actual client ip?

I have a simple express app. which is Dockerized. This is Repository.

I used nginx as a reverse proxy there. when I visit http://45.33.97.232:3000, it gives me the actual IP. But, when I visit http://45.33.97.232/, It gives me the same server IP. But I need actual Client IP here. And I am using Server IP in nginx config file. but I have a restriction, I can't write Server IP in nginx config file.

This is my nginx config file,

server {
    listen 80 default_server;
    server_name 45.33.97.232;
location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://45.33.97.232:3000; #port where you are serving your express app.
  }
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In nginx if you want to pass through the IP address of the remote user to your backend web server you have to set X-Forwarded-For header to this remote ip, Like this:

proxy_set_header X-Forwarded-For $remote_addr;

and if you do not want to use server IP you can use the domain in your Nginx config file.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!