Bug 998068 - Set X-Forwarded-Port
Set X-Forwarded-Port
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Rob Millner
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-16 19:35 EDT by Rob Millner
Modified: 2015-05-14 19:26 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-29 08:52:27 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Rob Millner 2013-08-16 19:35:52 EDT
Description of problem:
Its difficult to construct self-referential URLs without the forwarded port information.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Create a php app
2. Add a php script that calls phpinfo
3. Access the script

Actual results:
No X-Forwarded-Port

Expected results:
X-Forwarded-Port should be provided alongside X-Forwarded-Host and X-Forwarded-Proto.

Additional info:
https://www.openshift.com/kb/kb-e1044-how-to-redirect-traffic-to-https
https://www.openshift.com/forums/openshift/redirect-to-https-fails-port-8443
Comment 1 Rob Millner 2013-08-16 20:35:46 EDT
Pull request:
https://github.com/openshift/origin-server/pull/3396

$ curl -s -k https://rm4-rmillner0077.dev.rhcloud.com:8443/phpinfo.php |grep X-Forwarded-
<tr><td class="e">X-Forwarded-For </td><td class="v">209.132.181.86 </td></tr>
<tr><td class="e">X-Forwarded-Proto </td><td class="v">https </td></tr>
<tr><td class="e">X-Forwarded-Host </td><td class="v">rm4-rmillner0077.dev.rhcloud.com </td></tr>
<tr><td class="e">X-Forwarded-Port </td><td class="v">8443 </td></tr>


$ curl -s -k http://rm4-rmillner0077.dev.rhcloud.com:8000/phpinfo.php |grep X-Forwarded-
<tr><td class="e">X-Forwarded-For </td><td class="v">209.132.181.86 </td></tr>
<tr><td class="e">X-Forwarded-Proto </td><td class="v">http </td></tr>
<tr><td class="e">X-Forwarded-Host </td><td class="v">rm4-rmillner0077.dev.rhcloud.com </td></tr>
<tr><td class="e">X-Forwarded-Port </td><td class="v">8000 </td></tr>


$ curl -s -k http://rm4-rmillner0077.dev.rhcloud.com:80/phpinfo.php |grep X-Forwarded-
<tr><td class="e">X-Forwarded-Proto </td><td class="v">http </td></tr>
<tr><td class="e">X-Forwarded-Port </td><td class="v">80 </td></tr>
<tr><td class="e">X-Forwarded-For </td><td class="v">209.132.181.86 </td></tr>
<tr><td class="e">X-Forwarded-Host </td><td class="v">rm4-rmillner0077.dev.rhcloud.com </td></tr>
<tr><td class="e">X-Forwarded-Server </td><td class="v">localhost </td></tr>


$ curl -s -k https://rm4-rmillner0077.dev.rhcloud.com:443/phpinfo.php |grep X-Forwarded-
<tr><td class="e">X-Forwarded-Proto </td><td class="v">https </td></tr>
<tr><td class="e">X-Forwarded-Port </td><td class="v">443 </td></tr>
<tr><td class="e">X-Forwarded-SSL-Client-Cert </td><td class="v">(null) </td></tr>
<tr><td class="e">X-Forwarded-For </td><td class="v">209.132.181.86 </td></tr>
<tr><td class="e">X-Forwarded-Host </td><td class="v">rm4-rmillner0077.dev.rhcloud.com </td></tr>
<tr><td class="e">X-Forwarded-Server </td><td class="v">localhost </td></tr>
Comment 2 openshift-github-bot 2013-08-16 22:31:51 EDT
Commit pushed to master at https://github.com/openshift/li

https://github.com/openshift/li/commit/830b1f7e27247468a8bf7afb2b2531ad7d753d99
Bug 998068 - Set X-Forwarded-Port header.
Comment 3 Meng Bo 2013-08-18 23:12:20 EDT
# curl http://php1-bmengdev.dev.rhcloud.com/phpinfo.php|grep -i x-forward 
<tr><td class="e">X-Forwarded-Proto </td><td class="v">http </td></tr>
<tr><td class="e">X-Forwarded-Port </td><td class="v">80 </td></tr>
<tr><td class="e">X-Forwarded-For </td><td class="v">10.147.177.146 </td></tr>
<tr><td class="e">X-Forwarded-Host </td><td class="v">php1-bmengdev.dev.rhcloud.com </td></tr>
<tr><td class="e">X-Forwarded-Server </td><td class="v">localhost </td></tr>

# curl -k https://php1-bmengdev.dev.rhcloud.com/phpinfo.php|grep -i x-forward
<tr><td class="e">X-Forwarded-Proto </td><td class="v">https </td></tr>
<tr><td class="e">X-Forwarded-Port </td><td class="v">443 </td></tr>
<tr><td class="e">X-Forwarded-SSL-Client-Cert </td><td class="v">(null) </td></tr>
<tr><td class="e">X-Forwarded-For </td><td class="v">10.147.177.146 </td></tr>
<tr><td class="e">X-Forwarded-Host </td><td class="v">php1-bmengdev.dev.rhcloud.com </td></tr>
<tr><td class="e">X-Forwarded-Server </td><td class="v">localhost </td></tr>

# curl -k https://php1-bmengdev.dev.rhcloud.com:8443/phpinfo.php|grep -i x-forward
<tr><td class="e">X-Forwarded-For </td><td class="v">10.147.177.146 </td></tr>
<tr><td class="e">X-Forwarded-Proto </td><td class="v">https </td></tr>
<tr><td class="e">X-Forwarded-Host </td><td class="v">php1-bmengdev.dev.rhcloud.com </td></tr>
<tr><td class="e">X-Forwarded-Port </td><td class="v">8443 </td></tr>

# curl -k http://php1-bmengdev.dev.rhcloud.com:8000/phpinfo.php|grep -i x-forward
<tr><td class="e">X-Forwarded-For </td><td class="v">10.147.177.146 </td></tr>
<tr><td class="e">X-Forwarded-Proto </td><td class="v">http </td></tr>
<tr><td class="e">X-Forwarded-Host </td><td class="v">php1-bmengdev.dev.rhcloud.com </td></tr>
<tr><td class="e">X-Forwarded-Port </td><td class="v">8000 </td></tr>


Verified on devenv_3672.

Note You need to log in before you can comment on or make changes to this bug.