V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
Y4ssss
V2EX  ›  NGINX

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

  •  
  •   Y4ssss · 2018-12-29 11:34:11 +08:00 · 3273 次点击
    这是一个创建于 2188 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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;
        			}
        		}
    						
    }
    
    2 条回复    2018-12-29 11:51:05 +08:00
    solos
        1
    solos  
       2018-12-29 11:50:05 +08:00
    nginx 1.13.10 版本开始支持 grpc,老版本可以把 grpc 当做 tcp server 来配置
    Y4ssss
        2
    Y4ssss  
    OP
       2018-12-29 11:51:05 +08:00
    @solos 版本是 1.14.2
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1016 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:22 · PVG 04:22 · LAX 12:22 · JFK 15:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.