cmd/tsdbrelay: copy X-Access-Token in correct place
@@ -61,9 +61,6 @@ func (t *tsdbrelayHTTPTransport) RoundTrip(req *http.Request) (*http.Response, e
if req.Header.Get("User-Agent") == "" {
req.Header.Add("User-Agent", t.UserAgent)
}
- if req.Header.Get("X-Access-Token") == "" {
- req.Header.Add("X-Access-Token", t.UserAgent)
- }
return t.RoundTripper.RoundTrip(req)
}
@@ -219,6 +216,7 @@ var (
relayHeader = "X-Relayed-From"
encHeader = "Content-Encoding"
typeHeader = "Content-Type"
+ accessHeader = "X-Access-Header"
myHost string
)
@@ -269,6 +267,9 @@ func (rp *relayProxy) relayPut(responseWriter http.ResponseWriter, r *http.Reque
if contenttype := r.Header.Get(typeHeader); contenttype != "" {
req.Header.Set(typeHeader, contenttype)
}
+ if access := r.Header.Get(accessHeader); access != "" {
+ req.Header.Set(accessHeader, access)
+ }
if encoding := r.Header.Get(encHeader); encoding != "" {
req.Header.Set(encHeader, encoding)
}
@@ -367,6 +368,9 @@ func (rp *relayProxy) relayMetadata(responseWriter http.ResponseWriter, r *http.
if contenttype := r.Header.Get(typeHeader); contenttype != "" {
req.Header.Set(typeHeader, contenttype)
}
+ if access := r.Header.Get(accessHeader); access != "" {
+ req.Header.Set(accessHeader, access)
+ }
if encoding := r.Header.Get(encHeader); encoding != "" {
req.Header.Set(encHeader, encoding)
}
