prometheus proxy add Header Host

This commit is contained in:
UlricQin 2022-01-08 19:40:43 +08:00
parent dcee4677ed
commit b9c674d662
3 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@
NOW = $(shell date -u '+%Y%m%d%I%M%S')
RELEASE_VERSION = 5.2.0
RELEASE_VERSION = 5.2.2
APP = n9e
SERVER_BIN = $(APP)

View File

@ -79,7 +79,7 @@ services:
- "server"
nwebapi:
image: ulric2019/nightingale:5.1.0
image: ulric2019/nightingale:5.2.1
container_name: nwebapi
hostname: nwebapi
restart: always
@ -107,7 +107,7 @@ services:
- "webapi"
nserver:
image: ulric2019/nightingale:5.1.0
image: ulric2019/nightingale:5.2.1
container_name: nserver
hostname: nserver
restart: always

View File

@ -36,6 +36,8 @@ func prometheusProxy(c *gin.Context) {
req.URL.Scheme = target.Scheme
req.URL.Host = target.Host
req.Header.Set("Host", target.Host)
// fe request e.g. /api/n9e/prometheus/api/v1/query
index := strings.Index(req.URL.Path, "/prometheus")
if index == -1 {