#26037: HttpRequest.get_host() uses either HTTP_X_FORWARDED_HOST or
HTTP_X_FORWARDED_PORT => should use both
-------------------------------+--------------------------------------
     Reporter:  benoitbryon    |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  HTTP handling  |                  Version:  1.9
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by benoitbryon):

 +1 for documentation tells "X-Forwarded-Host takes priority over X
 -Forwarded-Port". This would have saved me from trying to setup both
 USE_X_FORWARDED_PORT and USE_X_FORWARDED_HOST.

 +1 for documentation tells "X-Forwarded-Host may include port too", with a
 mention to http://tools.ietf.org/html/rfc7239#page-7 or
 http://tools.ietf.org/html/rfc7230#section-5.4.

 I updated my setup...

 * nginx with `proxy_set_header X-Forwarded-Host $host:$server_port;`
 (removed `x-forwarded-port`)
 * `settings.USE_X_FORWARDED_HOST = True` (removed `USE_X_FORWARDED_PORT`
 => False by default)

 ... and it just works as expected.

--
Ticket URL: <https://code.djangoproject.com/ticket/26037#comment:5>
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/069.bb1d5eac6d8be6e8c0660526ed4f5ee9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to