documentation: add tail_proxy_url option to query_frontend_config section (#2879)

* add tail_proxy_url option to the query_frontend_config section of configuration doc

* If queryFrontend run in tail proxy mode, append the Host of the tail_proxy_url to the request header, because in some scenario queryFrontend forward tail to the queriers deployed behind nginx and "Host" is required.
pull/2885/head
zhanghjster 5 years ago committed by GitHub
parent 9249ebc022
commit bc202ae7ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docs/sources/configuration/_index.md
  2. 7
      pkg/loki/modules.go

@ -296,6 +296,10 @@ The query_frontend_config configures the Loki query-frontend.
# Set to < 0 to enable on all queries.
# CLI flag: -frontend.log-queries-longer-than
[log_queries_longer_than: <duration> | default = 0s]
# URL of querier for tail proxy.
# CLI flag: -frontend.tail-proxy-url
[tail_proxy_url: <string> | default = ""]
```
## queryrange_config

@ -383,6 +383,13 @@ func (t *Loki) initQueryFrontend() (_ services.Service, err error) {
return nil, err
}
tp := httputil.NewSingleHostReverseProxy(tailURL)
director := tp.Director
tp.Director = func(req *http.Request) {
director(req)
req.Host = tailURL.Host
}
defaultHandler = httpMiddleware.Wrap(tp)
} else {
defaultHandler = frontendHandler

Loading…
Cancel
Save