Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#27485 closed New feature (wontfix)

Allow ALLOWED_HOSTS to accept an IP-range / wildcard

Reported by: Tom Turner Owned by: nobody
Component: HTTP handling Version: 1.10
Severity: Normal Keywords: ALLOWED_HOSTS
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



Now that Django 1.10.3 forces ALLOWED_HOSTS on with debug I have a problem.

The problem is that when I developing I use an ip-address range of 192.168.1.*.
The Ip-adress can change depending on the computer I use.

so I required the ability to add wildcard partly in an hostname.


ALLOWED_HOSTS = ['192.168.1.*', '']

I have seen this solution that doesn't require Django to be changed however I don't like it as I feel this could be a secuirty issue

I am happy to produce a patch however I will only do this if it's likely to get submitted

Change History (2)

comment:1 Changed 5 years ago by Tim Graham

Component: UncategorizedHTTP handling
Summary: ALLOWED_HOSTS ip-range / wildcardAllow ALLOWED_HOSTS to accept an IP-range / wildcard
Triage Stage: UnreviewedAccepted

I'm sympathetic to the use case, however, before coding I think it'd be good to raise the idea on the DevelopersMailingList to ensure no one sees a problem with it or has an alternative.

comment:2 Changed 5 years ago by Tom Turner

Resolution: wontfix
Status: newclosed

After posting on the group, there are ways around the problem.

The one I'm going with is:

from socket import gethostname, gethostbyname 
ALLOWED_HOSTS = [gethostname(), gethostbyname(gethostname())] 
Last edited 5 years ago by Tim Graham (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top