diff --git a/gunicorn/config.py b/gunicorn/config.py index c9045cb0..ce2e4c01 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -706,6 +706,10 @@ class ForwardedAllowIPS(Setting): desc = """\ Front-end's IPs from which allowed to handle X-Forwarded-* headers. (comma separate). + + Set to "*" to disable checking of Front-end IPs (useful for setups + where you don't know in advance the IP address of Front-end, but + you still trust the environment) """ class AccessLog(Setting): diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index 228ed941..2c1b347e 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -85,7 +85,8 @@ def create(req, sock, client, server, cfg): secure_headers = cfg.secure_scheme_headers x_forwarded_for_header = cfg.x_forwarded_for_header - if client and client[0] not in cfg.forwarded_allow_ips: + if '*' not in cfg.forwarded_allow_ips and client\ + and client[0] not in cfg.forwarded_allow_ips: x_forwarded_for_header = None secure_headers = {}