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.
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!
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.
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!
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