By sudeep135
I am attempting to fetch the real IP of the visitor on a Flask application that I am serving using Nginx server blocks on Ubuntu, but I get the same IP with all the visitors (my droplet’s IP). How do I fix this?
This is my current server config for my application.
server {
listen 80;
server_name subdomain.mysite.com;
location / {
proxy_pass http://0.0.0.0:8080;
proxy_redirect http://0.0.0.0:8080 http://subdomain.mysite.com;
}
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
@sudeep135
You need to setup the x-forwarded-for header, then read this header in your flask app to get the client’s real ip address.
Check out this tutorial for more info.
Hope this helps.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.