#30091: Invalid HTTP_HOST header causes CsrfViewMiddleware failure
-----------------------------------------+------------------------
               Reporter:  MrkGrgsn       |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  Uncategorized  |        Version:  1.11
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 I've observed that when using CSRF_USE_SESSIONS = True and with
 SessionMiddleware correctly placed before CsrfViewMiddleware that a
 request with an invalid HTTP_HOST header raises an exception and, while
 preparing a response for this exception, the CsrfViewMiddleware raises an
 unhandled ImproperlyConfigured exception and an internal server error is
 returned to the browser.

 I expect that an HTTP 400 will be returned to the user for an invalid
 HTTP_HOST header and that the CsrfViewMiddleware will not raise an
 exception.

 To reproduce, configure the application as above, set up a new hostname
 (one that is not in ALLOWED_HOSTS) pointing at the Django application
 (using the hosts file, for example), and then request that hostname.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.ade0e02339127cab3fb0c346ac61af81%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to