benoitc / gunicorn

gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and sleepy applications.
http://www.gunicorn.org
Other
9.65k stars 1.74k forks source link

How to set or whitelist specific IP addresse(s). #2949

Closed Anand195 closed 6 months ago

Anand195 commented 1 year ago

Hello, there

I would like to whitelist only those IP addresses for which I wan to serve the request, other than that just want to DENY.

here is the sample gunicorn settions which i follow

gunicorn --workers 3 --bind 192.168.1.33:5000 --worker-class gevent --worker-connections 10 --timeout 300 --preload rbw_parser_api.wsgi:application

I set ALLOWED_HOST = ['*'] in settings.py

DO let me know how can I set the whitelist or allowed IP list.

alexw92 commented 11 months ago

Same question here! Does Gunicorn allow a setting for IP White-Listing? If not is this feature in scope? Right now I think we can only choose between ever whitelisting IPs in the source code or using a proxy to do this.

tilgovi commented 6 months ago

There are many great proxies and firewall projects and lots of infrastructure that allows this. If you're not running in a cloud environment where network infrastructure is programmable to customize this, then you may have access to iptables. Gunicorn does not currently implement such a feature, nor is it planned at this time.