nginx 转发 gprc 请求, UNAVAILABLE: HTTP status code 502

2018-12-29 11:34:11 +08:00
 Y4ssss

client 报错:
UNAVAILABLE: HTTP status code 502

nginx 日志:
upstream sent too large http2 frame: 1377025 while reading response header from upstream, client: 127.0.0.1, server: hsltest.org1.peer0, request: "POST /protos.Events/Chat HTTP/2.0"

nginx 需要配置那些信息啊

nginx 配置如下

http {
    include       mime.types;

    default_type  application/octet-stream;
    log_format main '$remote_addr - $upstream_addr - [$time_local] "$request" $status    	 $body_bytes_sent "$http_referer" "$http_user_agent" "-" "$host"';
    access_log    logs/http.access.log;
    sendfile      on;
    tcp_nopush    on;
    tcp_nodelay   on;
    
	keepalive_timeout 240;
	grpc_buffer_size 8m;
	http2_max_field_size  2m;
	http2_max_header_size 2m;
	
	proxy_buffer_size   2m;
	proxy_buffers   4 2m;
	proxy_busy_buffers_size   2m;
	http2_recv_buffer_size 2m;
	http2_chunk_size  2m;
	
    server_names_hash_bucket_size 128;
   
    ssl on;
    ssl_certificate ssh/org1.peer0.tls.cer;
	ssl_certificate_key ssh/org1.peer0.tls.key;
	ssl_client_certificate ssh/org1.tlsca.cer;
	ssl_verify_client on;

	server {
    			listen 1051 ssl http2; 
				server_name hsltest.org1.peer0;	
    			location / {   		
    				grpc_pass grpc://192.168.235.128:1051;
    			}
    		}
						
}
3246 次点击
所在节点    NGINX
2 条回复
solos
2018-12-29 11:50:05 +08:00
nginx 1.13.10 版本开始支持 grpc,老版本可以把 grpc 当做 tcp server 来配置
Y4ssss
2018-12-29 11:51:05 +08:00
@solos 版本是 1.14.2

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/522214

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX