Skip to content

Commit

Permalink
fix server-alias on http/80
Browse files Browse the repository at this point in the history
  • Loading branch information
Dufour Alexis authored and jcmoraisjr committed May 5, 2020
1 parent ae30511 commit 8ecf15a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/haproxy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ func (c *config) BuildFrontendGroup() error {
}
if !hasSSLRedirect || c.global.Bind.HasFrontingProxy() {
fgroup.HTTPFrontsMap.AppendHostname(base, back)
fgroup.HTTPFrontsMap.AppendAliasName(aliasName, back)
fgroup.HTTPFrontsMap.AppendAliasRegex(aliasRegex, back)
}
var ns string
if host.VarNamespace {
Expand Down
11 changes: 10 additions & 1 deletion pkg/haproxy/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1832,7 +1832,15 @@ backend d3_app_8080
mode http
server s31 172.17.0.131:8080 weight 100
<<backends-default>>
<<frontend-http>>
frontend _front_http
mode http
bind :80
http-request set-var(req.base) base,lower,regsub(:[0-9]+/,/)
http-request redirect scheme https if { var(req.base),map_beg(/etc/haproxy/maps/_global_https_redir.map,_nomatch) yes }
<<http-headers>>
http-request set-var(req.backend) var(req.base),map_beg(/etc/haproxy/maps/_global_http_front.map,_nomatch)
http-request set-var(req.backend) var(req.base),map_reg(/etc/haproxy/maps/_global_http_front_regex.map,_nomatch) if { var(req.backend) _nomatch }
use_backend %[var(req.backend)] unless { var(req.backend) _nomatch }
default_backend _error404
frontend _front001
mode http
Expand All @@ -1854,6 +1862,7 @@ d3.local/ no
c.checkMap("_global_http_front.map", `
d1.local/ d1_app_8080
d2.local/ d2_app_8080
sub.d2.local/ d2_app_8080
d3.local/ d3_app_8080
`)
c.checkMap("_front001_host.map", `
Expand Down

0 comments on commit 8ecf15a

Please sign in to comment.