@@ -113,13 +113,6 @@ func main() {
113
113
log .Fatalf ("Invalid scheme for upstream URL %q, only 'http' and 'https' are supported" , upstream )
114
114
}
115
115
116
- for _ , headerArg := range extraHttpHeaders {
117
- header , val , found := strings .Cut (headerArg , ":" )
118
- if ! found || len (strings .TrimSpace (header )) == 0 || len (strings .TrimSpace (val )) == 0 {
119
- log .Fatalf ("extra-http-header %s is not in the format 'key:value'" , headerArg )
120
- }
121
- }
122
-
123
116
reg := prometheus .NewRegistry ()
124
117
reg .MustRegister (
125
118
collectors .NewGoCollector (),
@@ -137,8 +130,12 @@ func main() {
137
130
opts = append (opts , injectproxy .WithErrorOnReplace ())
138
131
}
139
132
140
- if len (extraHttpHeaders ) > 0 {
141
- opts = append (opts , injectproxy .WithExtraHttpHeaders (extraHttpHeaders ))
133
+ for _ , headerArg := range extraHttpHeaders {
134
+ header , val , found := strings .Cut (headerArg , ":" )
135
+ if ! found || len (strings .TrimSpace (header )) == 0 || len (strings .TrimSpace (val )) == 0 {
136
+ log .Fatalf ("extra-http-header %s is not in the format 'key:value'" , headerArg )
137
+ }
138
+ opts = append (opts , injectproxy .WithExtraHttpHeader (header , val ))
142
139
}
143
140
144
141
if len (rewriteHostHeader ) > 0 {
0 commit comments