Skip to content

Commit d5e0d68

Browse files
author
Peng Zhou
committed
fix bug pointed by Copilot
1 parent cb58d64 commit d5e0d68

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/k8sutil/haProxyHelper.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,15 @@ backend {{ .BackendName }}
268268
PortNumber: backends[0].Port,
269269
Path: backends[0].Path,
270270
}
271+
if backends[0].IsPathBased {
272+
backendTemplate += `
273+
http-request replace-path {{.Path}}(/)?(.*) /\2`
274+
}
271275
result += parseTemplateToString(backendTemplate, data)
272276
for _, backend := range backends {
273277
name := backend.GroupName
274278
groupReplicas := backend.Replicas
275-
if backend.IsPathBased {
276-
backendTemplate += `
277-
http-request replace-path {{.Path}}(/)?(.*) /\2`
278-
}
279+
279280
for i := 0; i < groupReplicas; i++ {
280281
data := &HAProxyTemplate{
281282
PortNumber: backend.TargetPort,

0 commit comments

Comments
 (0)