Question

How to see connecting client IP in my App Platform App?

Hi Community - I want to deploy my Flask API onto App Platform. In my code I have a whitelist to block unknown public IP addresses. The problem is I can’t find a connecting clients public IP address in the request headers. I’ve checked all the request headers and only see IPV6 addresses from DigitalOcean middleware/reverse proxies.

Does anyone know if I can see a connecting clients public IPv4 address in requests coming into App Platform? Failing that, is there a way I can secure my API from the general public? It is imperative that I lock down the IPs that can access the app.


Submit an answer


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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
January 23, 2025

Hey @Shookshank,

I don’t think this is available out of the box, but it looks like someone else had a similar idea and posted it on the DigitalOcean Product Ideas board. The best thing to do would be to head over and add your vote, as well as leave any additional comments about what you’d like to see implemented!

https://ideas.digitalocean.com/app-platform/p/restrict-access-to-app-platform-apps-via-a-trusted-sources-list

In the meantime, you could restrict access by adding authentication at the application level. For example, you could use an API key or token-based system to ensure only trusted clients can connect.

Additionally, you can retrieve the client IP using the X-Forwarded-For header in your Flask app to implement your whitelist logic.

Hope that helps!

- Bobby

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.