获取异常失败:WebSocket握手期间出错:意外的响应代码:403

时间:2018-12-30 14:20:46

标签: apache tomcat lets-encrypt

我遇到以下错误

WebSocket连接失败:WebSocket握手期间出错:意外的响应代码:403

说明。

我在服务器上使用Apache 2.4负载均衡器。我在服务器上配置了tomcat 8。好在我的tomcat 8中,我也在使用websocket连接。

我已经使用letsencrypt配置了ssl,在我的Apache 2.4中,我配置了https请求。让我放我的配置文件,这将进一步解释。见下文

 <IfModule mod_ssl.c>

    <VirtualHost *:443>

        # Add a http header to explicitly identify the node and be sticky
        Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

        # Declare the http server pool
        <Proxy "balancer://plf">
          BalancerMember "http://localhost:8080" route=node1 acquire=2000 retry=5 keepalive=on ping=30 connectiontimeout=2
          ProxySet stickysession=ROUTEID
        </Proxy>

        # Declare the pool dedicated to the websocket tunnels
        <Proxy "balancer://plf_ws">
          BalancerMember "ws://127.0.0.1:8080" route=node1 acquire=2000 retry=0 keepalive=on ping=30 connectiontimeout=2 disablereuse=on flushpackets=on
          ProxySet stickysession=ROUTEID
        </Proxy>

        # throw maintance page if server not found
        <Proxy "balancer://plf_error">
          BalancerMember "http://127.0.0.1:90" route=errornode1 acquire=2000 retry=0 keepalive=on ping=30 connectiontimeout=2 disablereuse=on flushpackets=on
          ProxySet stickysession=ROUTEID
        </Proxy>

        # Common options
        ProxyRequests           Off
        ProxyPreserveHost       On

        ProxyPass "/tmperror" "balancer://plf_error"
        ProxyPass "/"   "balancer://plf/"
        ProxyPass "wss://"   "balancer://plf_ws/"


        # Declare the redirection for the http requests
        ErrorDocument 503 /tmperror
        ServerName example1.com
        Include /etc/letsencrypt/options-ssl-apache.conf
        ServerAlias www.example1.com
        SSLCertificateFile /etc/letsencrypt/live/example1.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example1.com/privkey.pem
    </VirtualHost>

    <VirtualHost *:90>
        ServerAdmin support@example.com
        ServerName example.com
        ServerAlias www.example.com
        DocumentRoot /var/www/example.com/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

    <VirtualHost *:80>
       ServerName www.example1.com
       Redirect /  https://www.example1.com
    </VirtualHost>

    </IfModule>

0 个答案:

没有答案