添加关于Cloudflare gRPC启用以后需要等待的说明和测试方式 (#50)
* 添加开启gRPC后手动测试方法 * 添加关于cloudflare gRPC开启以后需要等待的中文说明 * 添加英文版本关于cloudflare gRPC等待的说明 * 修改grpc测试的命令 * 修改测试gRPC时的curl命令 * 修改测试gRPC时的curl命令
This commit is contained in:
parent
6b7e607731
commit
1a3cc9de23
@ -64,3 +64,46 @@ According to Cloudflare gRPC requirements: gRPC services must listen on port 443
|
||||
So if you need to enable CDN, you must use port 443 when configuring Nginx or Caddy reverse proxy gRPC and configure the certificate (Caddy will automatically apply and configure the certificate).
|
||||
|
||||
- Log in to Cloudflare and select the domain you are using. Go to the `Network` page and turn on the `gRPC` switch, then go to the `DNS` page, find the resolution record of the domain with gRPC configuration, and turn on the orange cloud icon to enable CDN.
|
||||
|
||||
After enable `gRPC` at cloudflare, it may not work immediately,so you may need to wait for a while, about 24hour or more. To be test if gRPC work, we can use `curl` and `nezha-agent -d`:
|
||||
|
||||
```bash
|
||||
localhost:~/agent# curl -H "content-type: application/grpc+proto" -H "authorization: Bearer test" https://xxx.xxx.ovh -v
|
||||
* processing: https://xxx.xxx.ovh
|
||||
* Trying [2606:4700:3035::ac43:8bed]:443...
|
||||
* Connected to xxx.xxx.ovh (2606:4700:3035::ac43:8bed) port 443
|
||||
# ... SSL info
|
||||
* using HTTP/2
|
||||
* h2 [:method: GET]
|
||||
* h2 [:scheme: https]
|
||||
* h2 [:authority: xxx.xxx.ovh]
|
||||
* h2 [:path: /]
|
||||
* h2 [user-agent: curl/8.2.1]
|
||||
* h2 [accept: */*]
|
||||
* Using Stream ID: 1
|
||||
> GET / HTTP/2
|
||||
> Host: xxx.xxx.ovh
|
||||
> User-Agent: curl/8.4.0
|
||||
> Accept: */*
|
||||
> content-type: application/grpc+proto
|
||||
> authorization: Bearer test
|
||||
>
|
||||
< HTTP/2 405
|
||||
< date: Wed, 20 Dec 2023 08:56:27 GMT
|
||||
< content-type: application/grpc+proto
|
||||
< cf-ray: 8386ac12dabd5ddc-HKG
|
||||
< cf-cache-status: DYNAMIC
|
||||
< grpc-message: Received a HEADERS frame with :method "GET" which should be POST
|
||||
< grpc-status: 13
|
||||
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=%2BTjgJvXWyRF11nUOYx9Lq7UDC1xOYBLtjvWrdjVJQIqu9YqnFJeZFran2KRs6zabQc%2BLV8AubNqYRYDb7hQAZe6bglmVz0wQjrb0tNovYf%2B59SAp%2BQfZnH%2BAFDydNT95ZCmTPnKgWetcwQiUfXU%3D"}],"group":"cf-nel","max_age":604800}
|
||||
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
|
||||
< vary: Accept-Encoding
|
||||
< server: cloudflare
|
||||
< alt-svc: h3=":443"; ma=86400
|
||||
<
|
||||
* Connection #0 to host xxx.xxx.ovh left intact
|
||||
localhost:~/agent# /opt/nezha/agent/nezha-agent -s xxx.xxx.ovh:443 -p YOUR_KEY --tls -d
|
||||
NEZHA@2023-12-20 05:14:00>> 检查更新: 0.15.14
|
||||
NEZHA@2023-12-20 05:14:01>> 上报系统信息失败: rpc error: code = Unknown desc = EOF # Edit GRPCHost and TLS at /opt/nezha/dashboard/data/config.yaml.
|
||||
NEZHA@2023-12-20 05:14:01>> Error to close connection ...
|
||||
```
|
||||
|
@ -64,3 +64,46 @@ Agent 端配置
|
||||
所以如果需要开启 CDN,必须在配置 Nginx 或者 Caddy 反向代理 gRPC 时使用 443 端口,并配置证书(Caddy 会自动申请并配置证书)。
|
||||
|
||||
- 登录 Cloudflare,选择使用的域名。打开 `网络` 选项将 `gRPC` 开关打开,打开 `DNS` 选项,找到 Nginx 或 Caddy 反代 gRPC 配置的域名的解析记录,打开橙色云启用 CDN。
|
||||
|
||||
开启`gRPC`后,可能不能立即可用,需要等待一段时间。具体可通过`curl`和使用`nezha-agent -d`来验证:
|
||||
|
||||
```bash
|
||||
localhost:~/agent# curl -H "content-type: application/grpc+proto" -H "authorization: Bearer test" https://xxx.xxx.ovh -v
|
||||
* processing: https://xxx.xxx.ovh
|
||||
* Trying [2606:4700:3035::ac43:8bed]:443...
|
||||
* Connected to xxx.xxx.ovh (2606:4700:3035::ac43:8bed) port 443
|
||||
# ... SSL info
|
||||
* using HTTP/2
|
||||
* h2 [:method: GET]
|
||||
* h2 [:scheme: https]
|
||||
* h2 [:authority: xxx.xxx.ovh]
|
||||
* h2 [:path: /]
|
||||
* h2 [user-agent: curl/8.2.1]
|
||||
* h2 [accept: */*]
|
||||
* Using Stream ID: 1
|
||||
> GET / HTTP/2
|
||||
> Host: xxx.xxx.ovh
|
||||
> User-Agent: curl/8.4.0
|
||||
> Accept: */*
|
||||
> content-type: application/grpc+proto
|
||||
> authorization: Bearer test
|
||||
>
|
||||
< HTTP/2 405
|
||||
< date: Wed, 20 Dec 2023 08:56:27 GMT
|
||||
< content-type: application/grpc+proto
|
||||
< cf-ray: 8386ac12dabd5ddc-HKG
|
||||
< cf-cache-status: DYNAMIC
|
||||
< grpc-message: Received a HEADERS frame with :method "GET" which should be POST
|
||||
< grpc-status: 13
|
||||
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=%2BTjgJvXWyRF11nUOYx9Lq7UDC1xOYBLtjvWrdjVJQIqu9YqnFJeZFran2KRs6zabQc%2BLV8AubNqYRYDb7hQAZe6bglmVz0wQjrb0tNovYf%2B59SAp%2BQfZnH%2BAFDydNT95ZCmTPnKgWetcwQiUfXU%3D"}],"group":"cf-nel","max_age":604800}
|
||||
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
|
||||
< vary: Accept-Encoding
|
||||
< server: cloudflare
|
||||
< alt-svc: h3=":443"; ma=86400
|
||||
<
|
||||
* Connection #0 to host xxx.xxx.ovh left intact
|
||||
localhost:~/agent# /opt/nezha/agent/nezha-agent -s nezha.xxx.xxx:443 -p YOUR_KEY --tls -d
|
||||
NEZHA@2023-12-20 05:14:00>> 检查更新: 0.15.14
|
||||
NEZHA@2023-12-20 05:14:01>> 上报系统信息失败: rpc error: code = Unknown desc = EOF # 需要修改主控端 /opt/nezha/dashboard/data/config.yaml的 GRPCHost 和 TLS 选项
|
||||
NEZHA@2023-12-20 05:14:01>> Error to close connection ...
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user