将 https 与仅支持 node-xmpp-bosh 的 http 一起使用

Posted

技术标签:

【中文标题】将 https 与仅支持 node-xmpp-bosh 的 http 一起使用【英文标题】:Use https with only http supporting node-xmpp-bosh 【发布时间】:2016-06-30 16:58:41 【问题描述】:

简介

我使用converse.js 作为 XMPP 网络客户端。因此我需要一个处理双向通信的 bosh 服务器。 因此,服务器充当node-xmpp-bosh。由于我的网站是 SSL/TLS 加密的,并且只能通过 https 访问,因此只能通过加密通信连接到 bosh 服务器。 不幸的是 node-xmpp-bosh 不支持 SSL/TLS。

问题

我可以通过以某种方式转发流量来规避这个问题吗?还是我迷路了,需要搜索另一个 bosh 服务器?

【问题讨论】:

【参考方案1】:

几个小时后......再次快乐:)

我的问题的解决方案是将流量代理到 bosh 服务器。要在 Apache 上执行此操作,我现在(或至少目前)使用此 VirtualHost 配置:

<VirtualHost *:443>
    ServerName bosh.domain.tld
    ServerAlias www.bosh.domain.tld

    ServerAdmin admin@domain.tld

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

    ProxyPass / http://127.0.0.1:5280/http-bind/
    ProxyPassReverse / http://127.0.0.1:5280/http-bind/


    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/domain.tld/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/domain.tld/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/domain.tld/chain.pem
    SSLVerifyClient None
    # HSTS (mod_headers is required) (15768000 seconds = 6 months)
    Header always set Strict-Transport-Security "max-age=15768000"
</VirtualHost>

【讨论】:

以上是关于将 https 与仅支持 node-xmpp-bosh 的 http 一起使用的主要内容,如果未能解决你的问题,请参考以下文章

如何将 Entry API 与仅在 Entry 空置时构建的昂贵密钥一起使用?

与仅使用 systemd 相比,我从 JSVC 获得啥好处?

SQL Server 中的可延迟约束

Flex:MX + Sparks 与仅 MX 组件

隐式授权工作流程与仅用于身份验证的授权代码授予的缺点?

如果 HTTP/1.1 客户端与仅 HTTP/2 的服务器通信会怎样,如果 HTTP/2 客户端与仅 HTTP/1.1 的服务器通信会怎样?