Bug 1461466 - The router does not do a case-insensitive match of a hostname
The router does not do a case-insensitive match of a hostname
Status: VERIFIED
Product: OpenShift Container Platform
Classification: Red Hat
Component: Routing (Show other bugs)
3.6.0
Unspecified Unspecified
medium Severity medium
: ---
: 3.7.0
Assigned To: Phil Cameron
zhaozhanqi
:
Depends On:
Blocks: 1467006
  Show dependency treegraph
 
Reported: 2017-06-14 09:44 EDT by Ben Bennett
Modified: 2017-08-14 14:15 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1467006 (view as bug list)
Environment:
Last Closed:
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)


External Trackers
Tracker ID Priority Status Summary Last Updated
Origin (Github) 14157 None None None 2017-06-14 09:44 EDT

  None (edit)
Description Ben Bennett 2017-06-14 09:44:17 EDT
Description of problem:

If you have a route for openshift.io/foo and an HTTP request comes in for: http://OPENshift.io/foo it will not be served.  In DNS the hostnames are specified to be case insensitive, so we should support that (in both HTTP and in SNI).  BUT we need to make sure that the path matches are done in a case sensitive way.


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

Definitely 3.6.  Probably forever.


How reproducible:

100%


Steps to Reproduce:
1. [Create a test endpoint, expose it, and get the hostname]
   oc create -f examples/hello-openshift/hello-pod.json
   oc expose pod hello-openshift
   oc expose svc hello-openshift
   oc get route hello-openshift
2. [Create a router and get its IP]
   oadm router
   oc get pod -o wide
3. curl http://172.17.0.3/ -H 'Host: hello-openshift-default.router.default.svc.cluster.local'  # Works
   curl http://172.17.0.3/ -H 'Host: hello-openshift-default.router.default.svc.cluster.locaL'  # Fails (note the L at the end)


Actual results:

curl http://172.17.0.3/ -H 'Host: hello-openshift-default.router.default.svc.cluster.locaL' returns a 503 error and the associated "service not found" page.


Expected results:

Hello Openshift!

(the same as the lower case hostname)

Additional info:

Note that the same needs to work for https routes terminated at the router (edge and reencrypt) and TLS w/ SNI pass-through routes.

Test with:
  oc create route edge hello-openshift-edge --service=hello-openshift
  curl -k https://hello-openshift-edge-default.router.default.svc.cluster.local/ --resolve hello-openshift-edge-default.router.default.svc.cluster.local:443:172.17.0.3
  curl -k https://hello-openshift-edge-default.router.default.svc.cluster.locaL/ --resolve hello-openshift-edge-default.router.default.svc.cluster.local:443:172.17.0.3

And we MUST differentiate between paths /foo and /FOO.  Those are two different routes, and must be treated as such.
Comment 1 Ben Bennett 2017-06-14 09:46:11 EDT
We also need to ensure that the router treats domain names of different cases as the same thing when it is handling the hostname reservations.
Comment 7 Eric Paris 2017-06-27 19:54:47 EDT
Fix:
https://github.com/openshift/origin/pull/14157
Test to merge after fix:
https://github.com/openshift/origin/pull/14858
Comment 8 Eric Paris 2017-07-01 09:10:42 EDT
marking as MODIFIED. The fix emrged. I closed this bug to track the addition of the test.
Comment 10 zhaozhanqi 2017-07-05 05:21:28 EDT
Verified this bug on v3.6.133

all kind of routes are work well with capital letter


$ oc get route
NAME               HOST/PORT                                     PATH      SERVICES           PORT      TERMINATION   WILDCARD
edge1              edge1-z2.0705-2fq.qe.rhcloud.com                        service-unsecure   http      edge          None
pass               pass-z2.0705-2fq.qe.rhcloud.com                         service-secure     https     passthrough   None
reen               reen-z2.0705-2fq.qe.rhcloud.com                         service-secure     https     reencrypt     None
service-unsecure   service-unsecure-z2.0705-2fq.qe.rhcloud.com             service-unsecure   http                    None

$ curl https://EDGE1-z2.0705-2fq.qe.rhcloUD.COM/test/ -k 
Hello-OpenShift-Path-Test http-8080
$ curl https://PASS-z2.0705-2fq.qe.rhcloUD.COM/ -k 
Hello-OpenShift-1 https-8443
$ curl https://REEN-z2.0705-2fq.qe.rhcloUD.COM/ -k 
Hello-OpenShift-1 https-8443
$ curl SERVICE-UNSecure-z2.0705-2fq.qe.rhcloud.com
Hello-OpenShift-1 http-8080
Comment 11 openshift-github-bot 2017-08-04 17:49:01 EDT
Commits pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/9b90badec96c297832df771f78fdbf0daa2589a2
Test case for mixed/uppercase host name

This is a test case for PR 14157

When a  user provides a mixed or uppercase host name the router converts
it to lower case before matching it to existing routes.

Test for:
https://github.com/openshift/origin/pull/14157

Fixes bug 1461466
https://bugzilla.redhat.com/show_bug.cgi?id=1461466

https://github.com/openshift/origin/commit/ddb26b463f4d2d6e111122c254337fdeeb3a3f2b
Merge pull request #15640 from pecameron/bz1461466u

Automatic merge from submit-queue

Test case for mixed/uppercase host name

This is a test case for PR 14157

When a  user provides a mixed or uppercase host name the router converts
it to lower case before matching it to existing routes.

Test for:
https://github.com/openshift/origin/pull/14157

Fixes bug 1461466
https://bugzilla.redhat.com/show_bug.cgi?id=1461466

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