#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:  Uncategorized  |                  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):

 In the case `X_FORWARDED_PORT` is considered a edge-case and not a
 standard (see discussion at https://code.djangoproject.com/ticket/19517),
 an alternative to resolve the use case would be mentioning both domain and
 port in X_FORWARDED_HOST header, i.e. don't use X_FORWARDED_PORT at all.

 Example:

 * Django settings declare `USE_X_FORWARDED_HOST = True`
 * Reverse proxy sets header `X_FORWARDED_HOST = "example.com:8080"`
 * `request.get_host()` returns `example.com:8080`

 If this approach is preferred, it would be nice to mention it in the
 documentation, so that users know when to use
 settings.USE_X_FORWARDED_HOST and settings.USE_X_FORWARDED_PORT. At the
 moment, it is not obvious that we cannot use HOST and PORT at the same
 time.

--
Ticket URL: <https://code.djangoproject.com/ticket/26037#comment:2>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.8265fc9df8f63e7b73436a451ad9464a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to