nginx 499错误vaadin 8,spring boot

时间:2018-04-30 04:32:50

标签: spring-boot nginx vaadin8

  • Vaadin 8.4.0
  • @Push(transport = Transport.WEBSOCKET_XHR)
  • Spring boot 2.0.1

自vaadin 8.4.0以来,我们遇到了一些nginx错误。我们在不同的设备和浏览器上测试我们的系统,但我们没有错误。在我们的日志系统中,我们发现了以下错误

ngix错误日志:/错误有时,不是/

499 | POST /vaadinServlet/HEARTBEAT/?v-uiId=0 HTTP/2.0

499 | POST /vaadinServlet/UIDL/?v-uiId=2 HTTP/2.0

18184#0: *266253 upstream prematurely closed connection while reading response header from upstream

nginx.conf文件:

server {
    listen xxx.xxx.xxx.xxx:443 ssl http2;

    server_name tld.com;
    server_name www.tld.com;
    server_name ipv4.tld.com;

    ssl_certificate             /opt/psa/var/certificates/cert-xxxxxx;
    ssl_certificate_key         /opt/psa/var/certificates/cert-xxxxxx;
    ssl_client_certificate      /opt/psa/var/certificates/cert-xxxxxx;

    client_max_body_size 128m;

    # disable unsupported ciphers
    ssl_ciphers AESGCM:HIGH:!aNULL:!MD5;

    # ssl optimizations
    ssl_session_cache shared:SSL:60m;
    ssl_session_timeout 60m;
    add_header Strict-Transport-Security "max-age=31536000";

    root "/var/www/vhosts/tld.com/httpdocs";
    access_log "/var/www/vhosts/system/tld.com/logs/proxy_access_ssl_log";
    error_log "/var/www/vhosts/system/tld.com/logs/proxy_error_log";

    if ($host ~* ^www\.tld\.com$) {
            #rewrite ^(.*)$ https://tld.com$1 permanent;
            return 301 https://tld.com$request_uri;
    }


    location / {
            proxy_pass https://xxx.xxx.xxx.xxx:801; #7081 | 801
            proxy_set_header Host             $host;
            proxy_set_header X-Real-IP        $remote_addr;
            proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_set_header X-Accel-Internal /internal-nginx-static-location;

            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";

            proxy_connect_timeout   3600;
            proxy_read_timeout      84600s;
            proxy_send_timeout      84600s;
    }

     location ~ ^/(vaadinServlet|VAADIN) {
           proxy_set_header          X-Forwarded-Host        $host;
           proxy_set_header          X-Forwarded-Server      $host;
           proxy_set_header          X-Real-IP               $remote_addr;
           proxy_set_header          X-Forwarded-For         $proxy_add_x_forwarded_for;
           proxy_set_header          Host                    $host;
           proxy_http_version        1.1;
           proxy_set_header          Upgrade                 $http_upgrade;
           proxy_set_header          Connection              "upgrade";
           proxy_buffering           off;
           proxy_ignore_client_abort off;
           proxy_pass                https://xxx.xxx.xxx.xxx:801;
           proxy_read_timeout 84600s;
           proxy_send_timeout 84600s;
           proxy_redirect off;
    }

    location /internal-nginx-static-location/ {
            alias /var/www/vhosts/tld.com/httpdocs/;
            internal;
    }

    location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
            proxy_pass https://xxx.xxx.xxx.xxx:7081;
            proxy_set_header Host             $host;
            proxy_set_header X-Real-IP        $remote_addr;
            proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_set_header X-Accel-Internal /internal-nginx-static-location;
            access_log off;
    }

    add_header X-Powered-By PleskLin;

        include "/var/www/vhosts/system/tld.com/conf/vhost_nginx.conf";
}
# VAADIN PUSH
    map $http_upgrade $connection_upgrade {
            default upgrade;
            '' close;
    }


server {
        listen xxx.xxx.xxx.xxx:80;

        server_name tld.com;
        server_name www.tld.com;
        server_name ipv4.tld.com;

        client_max_body_size 128m;

        return 301 https://$host$request_uri;
}

3 个答案:

答案 0 :(得分:0)

499 - NGX_HTTP_CLIENT_CLOSED_REQUEST是客户端关闭连接时的状态代码。

您可以在此处查看有关Nginx状态代码的更多信息:web application

您可以使用curl ctrl + c 来中断请求。

另一个可能的原因是客户端超时,通常是在负载均衡器中,因此通过增加超时(https://www.nginx.com/resources/wiki/extending/api/http/)可以帮助解决问题

答案 1 :(得分:0)

这是vaadin 8.4.0的bug并在8.4.1中修复。 /气氛2.4.24 / https://github.com/vaadin/framework/issues/10861#issuecomment-386611465

答案 2 :(得分:0)

vaadin 8.6.3,Spring Boot 2.0.3 enter image description here