【发布时间】:2023-02-17 02:31:00
【问题描述】:
我尝试通过 nginx 服务器从 api 用户连接到我的 hyperledger fabric 网络。我的 *.conf 文件中有下一个设置:
- 第一个文件
upstream rca-org1 {
server XXXX:7054;
}
upstream couchdb {
server XXXX:5984;
}
server {
listen XXXX:80 default_server;
listen [::]:80;
server_name XXXX;
access_log path/to/nginx/access.log;
location / {
root /app/build;
index index.html;
try_files $uri /index.html;
}
location /api {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://rca-org1;
}
location /wallet {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://couchdb;
}
- 第二个文件
upstream network {
server XXXX:7051;
}
server {
listen 80 http2;
listen [::]:80;
server_name XXXX;
access_log /path/to/nginx/access.log;
location /channels {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
grpc_pass grpc://network;
}
location ~/(static|media)/ {
root /app/build/;
}
}
当我尝试执行从 k8s claster(在 k8s 集群中存储我的 node.js api 和我的 hf 网络)到 nginx 的连接请求时,我收到此输出:
Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: Protocol error at Object.callErrorFromStatus (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/call.js:31:19) at Object.onReceiveStatus (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/client.js:190:52) at Object.onReceiveStatus (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141) at Object.onReceiveStatus (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181) at /path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78 at processTicksAndRejections (internal/process/task_queues.js:77:11) for call at at ServiceClientImpl.makeUnaryRequest (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/client.js:160:30) at ServiceClientImpl.<anonymous> (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19) at /path/to/node_modules/fabric-common/lib/Discoverer.js:73:17 at new Promise (<anonymous>) at Discoverer.sendDiscovery (/path/to/node_modules/fabric-common/lib/Discoverer.js:54:10) at DiscoveryService.send (/path/to/node_modules/fabric-common/lib/DiscoveryService.js:318:30) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async NetworkImpl._initializeInternalChannel (/path/to/node_modules/fabric-network/lib/network.js:300:13) at async NetworkImpl._initialize (/path/to/node_modules/fabric-network/lib/network.js:250:9) at async Gateway.getNetwork (/path/to/node_modules/fabric-network/lib/gateway.js:350:9) at async fabricConnectorForUser (/path/to/custom_policies/fabricConnectorForUser/index.js:28:23)
我的访问日志:
10.39.22.45 - - [29/Sep/2022:16:57:52 +0300] "PRI * HTTP/2.0" 400 157 "-" "-"
我的错误日志:
2022/09/29 16:57:21 [warn] 5810#5810: conflicting server name "XXXX" on [::]:80, ignored
【问题讨论】:
-
“协议错误”通常表示客户端从与其交互的服务器或代理那里得到的不是有效的 HTTP/2 响应。