prometheus proxy add Header Host
This commit is contained in:
parent
dcee4677ed
commit
b9c674d662
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
NOW = $(shell date -u '+%Y%m%d%I%M%S')
|
NOW = $(shell date -u '+%Y%m%d%I%M%S')
|
||||||
|
|
||||||
RELEASE_VERSION = 5.2.0
|
RELEASE_VERSION = 5.2.2
|
||||||
|
|
||||||
APP = n9e
|
APP = n9e
|
||||||
SERVER_BIN = $(APP)
|
SERVER_BIN = $(APP)
|
||||||
|
|
|
@ -79,7 +79,7 @@ services:
|
||||||
- "server"
|
- "server"
|
||||||
|
|
||||||
nwebapi:
|
nwebapi:
|
||||||
image: ulric2019/nightingale:5.1.0
|
image: ulric2019/nightingale:5.2.1
|
||||||
container_name: nwebapi
|
container_name: nwebapi
|
||||||
hostname: nwebapi
|
hostname: nwebapi
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -107,7 +107,7 @@ services:
|
||||||
- "webapi"
|
- "webapi"
|
||||||
|
|
||||||
nserver:
|
nserver:
|
||||||
image: ulric2019/nightingale:5.1.0
|
image: ulric2019/nightingale:5.2.1
|
||||||
container_name: nserver
|
container_name: nserver
|
||||||
hostname: nserver
|
hostname: nserver
|
||||||
restart: always
|
restart: always
|
||||||
|
|
|
@ -36,6 +36,8 @@ func prometheusProxy(c *gin.Context) {
|
||||||
req.URL.Scheme = target.Scheme
|
req.URL.Scheme = target.Scheme
|
||||||
req.URL.Host = target.Host
|
req.URL.Host = target.Host
|
||||||
|
|
||||||
|
req.Header.Set("Host", target.Host)
|
||||||
|
|
||||||
// fe request e.g. /api/n9e/prometheus/api/v1/query
|
// fe request e.g. /api/n9e/prometheus/api/v1/query
|
||||||
index := strings.Index(req.URL.Path, "/prometheus")
|
index := strings.Index(req.URL.Path, "/prometheus")
|
||||||
if index == -1 {
|
if index == -1 {
|
||||||
|
|
Loading…
Reference in New Issue