【问题标题】:mod_proxy_wstunnel with cometd running on jetty在码头上运行 cometd 的 mod_proxy_wstunnel
【发布时间】:2016-06-01 15:57:49
【问题描述】:

我正在尝试将 Apache 用作运行 cometd 的 Jetty 服务器的反向代理。

我的设置是这样工作的:

Apache(HTTPS) --> Jetty(HTTP)

这是 Apache 配置文件

<VirtualHost *:443>
        ServerAdmin xxx@domain.com
        ServerName y.domain.com

        ProxyPass / http://localhost:8888/
        ProxyPassReverse / http://localhost:8888/

        ProxyPass /ws/  ws://localhost:8888/
        ProxyPass /wss/ wss://localhost:8888/

        ProxyRequests Off
        ProxyVia On
        Timeout 1500
        KeepAlive On
        MaxKeepAliveRequests 100
        KeepAliveTimeout 15

        <Proxy *>
                Order deny,allow
                Deny from all
                Allow from all
        </Proxy>

        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/localhost.crt
        SSLCertificateKeyFile /etc/apache2/ssl/localhost.key
        SSLCertificateChainFile /etc/apache2/ssl/ca.crt

        ErrorLog /var/log/apache2/error.log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
        ServerSignature On
</VirtualHost>

在我使用 cometd.js 的客户端上。

但是我在握手期间在客户端上收到此错误

Error during WebSocket handshake: Unexpected response code: 400

地址是wss://y.domain.com

之后,客户端再次尝试并且站点启动 - 但我担心握手是长时间轮询......

我错过了什么?

【问题讨论】:

  • Jetty前面的Apache是​​一个已知的性能和能力瓶颈,你能解释一下为什么你觉得需要使用setup吗?
  • 好吧,我的应用程序使用了 4 个不同的虚拟主机,它们在同一台服务器上运行。其中一些使用本地 apache,而另一些则使用 apache 作为反向代理。因为我希望它们都使用端口 443 的 SSL 运行,所以 Apache/NGINX 似乎是最好的选择。如果我在本机模式下运行 Jetty(使用端口 443),那么我必须移动到 2 台不同的机器上,这是我应该避免的。

标签: websocket jetty mod-proxy cometd


【解决方案1】:

ProxyPass 指令的排序事项

配置的 ProxyPass 和 ProxyPassMatch 规则按照配置顺序进行检查。第一条匹配的规则获胜。

http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-07
    • 1970-01-01
    • 2019-10-10
    • 2013-10-31
    • 1970-01-01
    • 1970-01-01
    • 2017-02-16
    • 1970-01-01
    相关资源
    最近更新 更多