@@ -113,13 +113,6 @@ func main() {
113113 log .Fatalf ("Invalid scheme for upstream URL %q, only 'http' and 'https' are supported" , upstream )
114114 }
115115
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-
123116 reg := prometheus .NewRegistry ()
124117 reg .MustRegister (
125118 collectors .NewGoCollector (),
@@ -137,8 +130,12 @@ func main() {
137130 opts = append (opts , injectproxy .WithErrorOnReplace ())
138131 }
139132
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 ))
142139 }
143140
144141 if len (rewriteHostHeader ) > 0 {
0 commit comments