[Django] #27485: ALLOWED_HOSTS ip-range / wildcard

127 views
Skip to first unread message

Django

unread,
Nov 14, 2016, 5:05:45 PM11/14/16
to django-...@googlegroups.com
#27485: ALLOWED_HOSTS ip-range / wildcard
-----------------------------------------+-------------------------------
Reporter: Tom Turner | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords: ALLOWED_HOSTS
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+-------------------------------
Hi

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.

ie
{{{
ALLOWED_HOSTS = ['192.168.1.*', '.mydomain.com']
}}}


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

http://stackoverflow.com/questions/37031749/django-allowed-hosts-ips-range


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

--
Ticket URL: <https://code.djangoproject.com/ticket/27485>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 15, 2016, 6:16:09 PM11/15/16
to django-...@googlegroups.com
#27485: Allow ALLOWED_HOSTS to accept an IP-range / wildcard
-------------------------------+------------------------------------

Reporter: Tom Turner | Owner: nobody
Type: New feature | Status: new
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: ALLOWED_HOSTS | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted
* component: Uncategorized => HTTP handling


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/27485#comment:1>

Django

unread,
Nov 17, 2016, 5:02:55 PM11/17/16
to django-...@googlegroups.com
#27485: Allow ALLOWED_HOSTS to accept an IP-range / wildcard
-------------------------------+------------------------------------
Reporter: Tom Turner | Owner: nobody
Type: New feature | Status: closed

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: wontfix

Keywords: ALLOWED_HOSTS | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tom Turner):

* status: new => closed
* resolution: => wontfix


Comment:

After posting on the group there are way round the problem.

The one I going with is

{{{
from socket import gethostname, gethostbyname
ALLOWED_HOSTS = [ gethostname(), gethostbyname(gethostname()), ]
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27485#comment:2>

Reply all
Reply to author
Forward
0 new messages