Good afternoon,

It seems pretty straightforward to me as a win with no downsides.  Chrome 
resolves subdomains of localhost as localhost.  I did a little searching 
(but forgot to keep the sources) and discovered that this behavior was 
intentional and spec compliant.  This is extremely handy for local 
development since it allows one to test subdomains without fooling with 
network DNS or modifying host files.

I opened ticket https://code.djangoproject.com/ticket/31010 and was asked 
to canvas for opinions.

I think that updating the handling of ALLOWED_HOSTS in 
HttpRequest.get_host()from:

        # Allow variants of localhost if ALLOWED_HOSTS is empty and DEBUG=True.
        allowed_hosts = settings.ALLOWED_HOSTS
        if settings.DEBUG and not allowed_hosts:
            allowed_hosts = ['localhost', '127.0.0.1', '[::1]']


to

        # Allow variants of localhost if ALLOWED_HOSTS is empty and DEBUG=True.
        allowed_hosts = settings.ALLOWED_HOSTS
        if settings.DEBUG and not allowed_hosts:
            allowed_hosts = ['.localhost', '127.0.0.1', '[::1]']


would be safe and support this pattern without requiring any changes to 
settings files which is quite nice for new projects.  Please let me know 
what you think =)

Thanks,
Gordon



-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b9e276f0-76f1-4a9c-be22-cb7286c20ec5%40googlegroups.com.

Reply via email to