Forums

Limit a Flask application to a certain IP range

Hi,

Is there a best-practice way to limit incoming traffic to my flask application to a certain IP range? Maybe in the WSGI configuration or elsewhere?

I don't want the application to be accessible to everyone on the web, and I'm not keen on the password protect option.

Many thanks.

To do that, you'd have to inspect the source IP in each request. There are details about getting the client IP here

Thanks! I appreciate your help.