Bug 1561752

Summary: Wildcard routes take precedence over other routes that start with a number
Product: OpenShift Container Platform Reporter: Eric Rich <erich>
Component: NetworkingAssignee: Ram Ranganathan <ramr>
Status: CLOSED ERRATA QA Contact: Meng Bo <bmeng>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.6.0CC: aos-bugs, bbennett, hongli, zzhao
Target Milestone: ---   
Target Release: 3.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1570143 (view as bug list) Environment:
Last Closed: 2018-07-30 19:11:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1570143    

Description Eric Rich 2018-03-28 19:58:14 UTC
Description of problem: when we enable this optional wildcard route: It takes precedence over other routes, rendering them unreachable, but we have noticed that it only overrides routes starting with a number.


Version-Release number of selected component (if applicable): kubernetes v1.6.1+5115d708d7

How reproducible: 100%


Steps to Reproduce:
1. https://gist.github.com/jmprusi/929ab4ffdf6dcda14dde704184421e80

curl service1.127.0.0.1.nip.io -> hits service1
curl random.127.0.0.1.nip.io -> hits route-wildcard, this is expected.
curl service2.127.0.0.1.nip.io -> hits service2
curl 3service127.0.0.1.nip.io -> hits route-wildcard, this is NOT expected


Additional info:

Comment 1 Eric Rich 2018-03-28 19:59:29 UTC
A PR to fix this issue seems to be proposed: https://github.com/openshift/origin/pull/19076

Comment 2 Ram Ranganathan 2018-04-09 19:26:09 UTC
Based on Clayton's review comments on the previous PR, 
created a new PR:  https://github.com/openshift/origin/pull/19219

Comment 3 Ram Ranganathan 2018-04-12 18:11:42 UTC
Setting to modified (is that the right workflow, @ben/@mengbo?) as the PR got merged.

Comment 4 Ram Ranganathan 2018-04-24 19:32:33 UTC
Version 2 PR: https://github.com/openshift/origin/pull/19492

Comment 6 zhaozhanqi 2018-05-17 05:24:05 UTC
Verified this bug on v3.10.0-0.47.0

steps:

1. enable the wildcard for router
  oc env dc router ROUTER_ALLOW_WILDCARD_ROUTES=true

2. Create one app with wildcard route
  $oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/wildcard_route/caddy-docker.json
 $oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/wildcard_route/route_edge.json
 $oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/wildcard_route/route_unsecure_test.example.com.json

3. Create another app with route with number prefix
  oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/header-test/dc.json
oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/header-test/insecure-service.json
 oc expose svc header-test-insecure --hostname=32zhao.test.example.com --name=zhao

4. Check the route 32zhao.test.example.com
  
 curl --resolve 32zhao.test.example.com:80:172.30.70.163 http://32zhao.test.example.com
<pre>
  user-agent: curl/7.29.0
  accept: */*
  host: 32zhao.test.example.com
  x-forwarded-host: 32zhao.test.example.com
  x-forwarded-port: 80
  x-forwarded-proto: http
  forwarded: for=172.18.10.50;host=32zhao.test.example.com;proto=http
  x-forwarded-for: 172.18.10.50
</pre>


5. Check the wildcard route 
# curl --resolve zhao.test.example.com:80:172.30.70.163 http://zhao.test.example.com
Hello-OpenShift-1 http-8080

Comment 8 errata-xmlrpc 2018-07-30 19:11:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:1816