#31354: When I am using a reverse proxy on a non-standard port 
request.get_host()
does not include the port
-------------------------------------+-------------------------------------
     Reporter:  dgcgh                |                    Owner:  dgcgh
         Type:  Bug                  |                   Status:  assigned
    Component:  Uncategorized        |                  Version:  3.0
     Severity:  Normal               |               Resolution:
     Keywords:  request get_host     |             Triage Stage:
  build_absolute_uri                 |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by dgcgh):

 I think the problem here might be that django assumes X-Forwarded-Host
 will include the port number, as opposed to putting the port number in X
 -Forwarded-Port.

 I can get the correct behavior by setting the nginx header as:
 {{{
 proxy_set_header X-Forwarded-Host  $host:$server_port;
 }}}
 and disabling `USE_X_FORWARDED_PORT` .
 I take it that `X-Forwarded-Port` is not popular, so maybe this bug is not
 worth fixing, but I will update my PR with a more explicit solution.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31354#comment:3>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.703026dd930f6ebd3d61dd1e050e03f4%40djangoproject.com.

Reply via email to