WebSocket(SockJS)的HTTPD 2.4.6配置

时间:2019-01-17 06:58:03

标签: apache websocket sockjs

我正在使用SockJS websocket客户端。

然后在tomcat服务器上打开WebSocket服务器。

在客户端和服务器之间,我想使用静态内容对httpd服务器进行本地化。

因此,我将配置设置如下。我无法从客户端连接WebSocket连接。我的配置有什么问题?

<VirtualHost *:80>
    ProxyPreserveHost On
    ### websocket
    RewriteEngine on

    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://localhost:6808%{REQUEST_URI} [P,QSA,L]

    RewriteEngine off

    #### rest api
    ProxyPass /auth/ ajp://localhost:8009/auth/
    ProxyPass /api/ ajp://localhost:8009/api/
    ProxyPass /mm3/ ajp://localhost:8009/mm3/
    ProxyPass /mepm/ ajp://localhost:8009/mepm/

   ### static contents
    DocumentRoot /var/www/html

    <FilesMatch "\.(html|htm|js|css|json)$">
      FileETag None

     <IfModule mod_headers.c>
       Header unset ETag
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Note "CACHING IS DISABLED ON LOCALHOST"
        Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
      </IfModule>
    </FilesMatch>

    <Directory "/var/www/html">
        AllowOverride All

        RewriteEngine On
        # If an existing asset or directory is requested go to it as it is
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
        RewriteRule ^ - [L]

        # If the requested resource doesn't exist, use index.html
        RewriteRule ^ \index.html
        AllowOverride All
    </Directory>
</VirtualHost>

0 个答案:

没有答案