nginx 错误:13内部:收到RST_STREAM,代码% 2由内部客户端错误触发:方案错误

3pmvbmvn  于 2023-03-29  发布在  Nginx
关注(0)|答案(1)|浏览(543)

我尝试通过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
elcex8rz

elcex8rz1#

我收到了同样的错误,不能保证它是相同的确切问题,因为我不使用nginx作为代理。我的设置是- nodejs和fabric-network库,并在本地运行它与fabric-samples/test-network。我的问题是我使用的connection_file不再匹配您在旋转测试网络时获得的组织连接文件。
因此,如果您的设置与我相同,请将fabric-samples/test-network/organizations/peerOrganizations/org{something}.example.com/connection-org{somemthing}.json文件复制到用于设置节点连接的连接文件(将在后端根目录下的config.json文件中定义)。基本上,当尝试连接到对等节点时,TLS验证失败。您还可以查看来自对等节点的日志以获取更多信息。

相关问题