Apache ProxyPass不适用于io.socket。获取wss:// url错误400

时间:2017-02-14 20:19:20

标签: apache websocket socket.io proxypass

我的域名网站使用ssl:https://www.irantk.ir

在我的防火墙中只允许http,https协议和80,443端口

我决定使用ProxyPass,但是没有工作和websocket错误400。 我的httpd.conf文件的结尾:

ng-style

请帮帮我

1 个答案:

答案 0 :(得分:0)

尝试这样

    <Proxy *>
   Require all granted
</Proxy>

Header        set        Connection "Upgrade"
RequestHeader setifempty Connection "Upgrade"
Header        set        Upgrade "websocket"
RequestHeader setifempty Upgrade "websocket"

ProxyRequests Off
ProxyPreserveHost On

# -----------------------------------------------------
RewriteEngine On


RewriteCond %{QUERY_STRING} transport=websocket           [NC,OR]
RewriteCond %{HTTP:Upgrade} websocket                     [NC,OR]
RewriteCond %{HTTP:Connection} upgrade                    [NC]
RewriteRule /socket.io/(.*)         ws://localhost:10000/socket.io/$1     [P]
ProxyPassReverse /                  ws://localhost:10000/

RewriteCond %{QUERY_STRING} transport=polling           [NC]
RewriteRule /socket.io/(.*)         http://localhost:10000/socket.io/$1   [P]
ProxyPassReverse /                  http://localhost:10000/

RewriteRule ^/socket.io/(.*)        http://localhost:10000/socket.io/$1   [P]
ProxyPassReverse /                  http://localhost:10000/

# -----------------------------------------------------