@@ -404,15 +404,18 @@ func (c *HAProxyController) handleRequestSetHdr(ingress *store.Ingress) {
404
404
}
405
405
// Configure annotation
406
406
for _ , param := range strings .Split (annReqSetHdr .Value , "\n " ) {
407
- parts := strings .Fields (param )
408
- if len (parts ) != 2 {
407
+ if param == "" {
408
+ continue
409
+ }
410
+ indexSpace := strings .IndexByte (param , ' ' )
411
+ if indexSpace == - 1 {
409
412
logger .Errorf ("incorrect value '%s' in request-set-header annotation" , param )
410
413
continue
411
414
}
412
415
logger .Tracef ("Ingress %s/%s: Configuring request set '%s' header " , ingress .Namespace , ingress .Name , param )
413
416
reqSetHdr := rules.SetHdr {
414
- HdrName : parts [ 0 ],
415
- HdrFormat : parts [ 1 ] ,
417
+ HdrName : param [: indexSpace ],
418
+ HdrFormat : " \" " + param [ indexSpace + 1 :] + " \" " ,
416
419
}
417
420
logger .Error (c .Cfg .HAProxyRules .AddRule (reqSetHdr , ingress .Namespace + "-" + ingress .Name , c .Cfg .FrontHTTP , c .Cfg .FrontHTTPS ))
418
421
}
@@ -441,7 +444,7 @@ func (c *HAProxyController) handleResponseSetHdr(ingress *store.Ingress) {
441
444
logger .Tracef ("Ingress %s/%s: Configuring response set '%s' header " , ingress .Namespace , ingress .Name , param )
442
445
resSetHdr := rules.SetHdr {
443
446
HdrName : param [:indexSpace ],
444
- HdrFormat : param [indexSpace + 1 :],
447
+ HdrFormat : " \" " + param [indexSpace + 1 :] + " \" " ,
445
448
Response : true ,
446
449
}
447
450
logger .Error (c .Cfg .HAProxyRules .AddRule (resSetHdr , ingress .Namespace + "-" + ingress .Name , c .Cfg .FrontHTTP , c .Cfg .FrontHTTPS ))
0 commit comments