Is there a way to set a range of ALLOWED_HOSTS IPs in django?
Something like this:
ALLOWED_HOSTS = ['172.17.*.*']
No, this is not currently possible. According to the docs, the following syntax is supported:
['www.example.com'] # Fully qualified domain
['.example.com'] # Subdomain wildcard, matches example.com and www.example.com
['*'] # Matches anything
If you look at the implementation of the validate_host
method, you can see that using '*'
by itself is allowed, but using *
as a wildcard as part of a string (e.g. '172.17.*.*'
) is not supported.