反向代理,连接websocket失败

发布于 2022-09-13 00:29:00 字数 2900 浏览 24 评论 0

现在有一个集群,head结点(10.240.212.91)上运行nginx,计算节点c1(10.240.212.94)上开启了一个服务https://10.240.212.94:12030/,想通过网址https://10.240.212.91:8082/连接到c1,一直报错,错误代码429,too many websocket handshake
nginx配置如下:

   map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }

   upstream backend {
        server 10.240.212.94:12030;
    }

    server {
        listen 8082 default_server;
        server_name localhost;

        sendfile        on;
        tcp_nopush      on;
        tcp_nodelay     on;

        keepalive_timeout  65;
        proxy_connect_timeout 60;
        proxy_read_timeout 36000;

        http2_max_concurrent_streams    512;
        http2_max_requests              10000;
        http2_chunk_size                16k;
        http2_recv_timeout              3600;
        http2_body_preread_size         256k;

        gzip                on;
        gzip_min_length     1000;
        gzip_comp_level     9;
        gzip_types          text/plain text/css text/xml
                       application/javascript application/xml application/json
                       application/pdf application/vnd.ms-excel;
        gzip_proxied        any;

        ssl_certificate             /etc/nginx/ssl/server.crt;
        ssl_certificate_key         /etc/nginx/ssl/server.key;
        ssl_session_timeout         1d;
        ssl_session_cache           shared:MozSSL:10m;  # about 40000 sessions
        ssl_session_tickets         off;
        ssl_early_data              on;

        ssl_dhparam                 /etc/nginx/ssl/dhparam.pem;

        ssl_protocols               TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_ciphers                 ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
        ssl_prefer_server_ciphers   off;

        add_header      Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" always;
        add_header      X-Content-Type-Options nosniff;
        add_header      X-XSS-Protection '1; mode=block';
        add_header      X-Frame-Options SAMEORIGIN;

        ssl_stapling on;
        ssl_stapling_verify on;



        error_page  497 =301 https://$host:$server_port$request_uri;


        location / {
           
            proxy_read_timeout 36000s;

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_set_header Host $host:8082;
            proxy_set_header Origin "";
           
            proxy_pass https://10.240.212.94:12030;

        }

请问是有什么参数设置有问题吗?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文