Nightingale-夜莺api验证问题v:6.0.0-ga.5

Viewed 49

请问api验证应该如何设置,现在的api是公开的,谁都能调用,因为我的服务打算部署在公网。但是配置文件对这块配置内容没有具体说明。以下是默认配置,都不生效,api依然是无需验证的
[HTTP.Pushgw]
Enable = true
[HTTP.Pushgw.BasicAuth]
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"

[HTTP.Alert]
Enable = true
[HTTP.Alert.BasicAuth]
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"

[HTTP.Heartbeat]
Enable = true
[HTTP.Heartbeat.BasicAuth]
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"

[HTTP.Service]
Enable = true
[HTTP.Service.BasicAuth]
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"


测试结果:

curl -I http://1.2.3.4:17000/prometheus/v1/write

HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 1301
Content-Type: text/html; charset=utf-8
Last-Modified: Thu, 20 Apr 2023 11:11:25 GMT

curl -I http://1.2.3.4:17000/v1/n9e/heartbeat

HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 1301
Content-Type: text/html; charset=utf-8
Last-Modified: Thu, 20 Apr 2023 11:11:25 GMT
Date: Thu, 27 Apr 2023 03:44:11 GMT

1 Answers

试试 POST 请求呢,数据上传和心跳估计都是 POST

确实是post请求就需要验证,但是我用的categraf采集器配置文件basicAuth默认是空,但可以上传数据,是不是categraf的验证有默认值,而默认值就是夜莺设置的默认验证

据我了解,没有默认值