-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Make the router handle ports properly (don't strip them). #12580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -218,6 +218,8 @@ func matchPattern(pattern, s string) bool { | |
| return false | ||
| } | ||
|
|
||
| // genSubdomainWildcardRegexp is now legacy and around for backward | ||
| // compatibility and allows old templates to continue running. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I say remove it. Old templates with new router - how far will we go?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you use config maps, you will run into issues once you upgrade/the latest image changes underneath you. |
||
| // Generate a regular expression to match wildcard hosts (and paths if any) | ||
| // for a [sub]domain. | ||
| func genSubdomainWildcardRegexp(hostname, path string, exactPath bool) string { | ||
|
|
@@ -235,6 +237,22 @@ func genSubdomainWildcardRegexp(hostname, path string, exactPath bool) string { | |
| return fmt.Sprintf("^[^\\.]*%s(|/.*)$", expr) | ||
| } | ||
|
|
||
| // Generate a regular expression to match route hosts (and paths if any). | ||
| func generateRouteRegexp(hostname, path string, wildcard bool) string { | ||
| hostRE := regexp.QuoteMeta(hostname) | ||
| if wildcard { | ||
| subdomain := routeapi.GetDomainForHost(hostname) | ||
| if len(subdomain) == 0 { | ||
| glog.Warningf("Generating subdomain wildcard regexp - invalid host name %s", hostname) | ||
| } else { | ||
| subdomainRE := regexp.QuoteMeta(fmt.Sprintf(".%s", subdomain)) | ||
| hostRE = fmt.Sprintf("[^\\.]*%s", subdomainRE) | ||
| } | ||
| } | ||
|
|
||
| return fmt.Sprintf("^%s(|:[0-9]+)%s(|/.*)$", hostRE, regexp.QuoteMeta(path)) | ||
| } | ||
|
|
||
| // Generates the host name to use for serving/certificate matching. | ||
| // If wildcard is set, a wildcard host name (*.<subdomain>) is generated. | ||
| func genCertificateHostName(hostname string, wildcard bool) string { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function does not get used in the template now. Remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I put a comment on the actual function - we can but it would break any existing template - for example if you use a config map. So my 2 cents are to keep it around a bit and remove it later - that's just safer.