【问题标题】:SockJS having problems with IE9SockJS 在 IE9 上遇到问题
【发布时间】:2012-11-16 12:56:53
【问题描述】:

我在这里看到了类似失败的报告:https://groups.google.com/forum/?fromgroups=#!topic/sockjs/QNtA1_p_arU,但我的问题似乎有所不同。

我的设置:客户端连接到 SockJS 的 https://www.mysite.com/sockjs,实际页面在 https://www.mysite.com/blah/blah/blah 提供。页面上的所有外部元素(例如 css 和 js)都使用 https 提供,包括 SockJS-Client (https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.js,应该是 0.3. 4 为最新版本)。后端使用 SockJS-Tornado 制作。

问题 1:我指定使用以下协议:

var options = {protocols_whitelist: ["websocket", "xhr-streaming", "xdr-streaming", "xhr-polling", "xdr-polling", "iframe-htmlfile", "iframe-eventsource", "iframe-xhr-polling"], debug: true};             
conn = new SockJS("https://www.mysite.com/sockjs", options);

然而,IE9 似乎只是使用了最糟糕的协议iframe-htmlfile,正如我在服务器日志中看到的那样:

INFO:root:200 GET /sockjs/info?t=1353062888578 (127.0.0.1) 0.51ms
INFO:root:200 GET /sockjs/iframe.html (127.0.0.1) 22.21ms

为什么不使用xdr-streamingxdr-polling?在 SockJS 文档中,它在 'IE8, 9 (cookies=no)' 下标记了这两个协议,这是否意味着 SockJS 仅在浏览器禁用 cookie 时才会使用它们?

问题 2:使用协议iframe-htmlfile,用户将在页面上收到'Only Secure Content is Displayed' 警告,这表明存在混合内容问题。但是,没有其他经过测试的浏览器报告此警告(例如 Chrome、FireFox、Safari),并且如前所述,页面上的每个外部资源都是通过 https 提供的。为什么是这样?是不是和这个具体使用的协议iframe-htmlfile有关?

同时,SockJS 难以连接到服务器并发送消息。这是我在服务器日志中看到的:

INFO:root:200 GET /sockjs/info?t=1353062888578 (127.0.0.1) 0.51ms
INFO:root:200 GET /sockjs/iframe.html (127.0.0.1) 22.21ms
INFO:root:200 GET /sockjs/info?t=1353062922712 (127.0.0.1) 0.39ms
connection openned for: 127.0.0.1
INFO:root:200 GET /sockjs/info?t=1353062963868 (127.0.0.1) 0.36ms
WARNING:root:Read error on 12: [Errno 104] Connection reset by peer
WARNING:root:error on read
Traceback (most recent call last):
  File "/home/ml/envs/.virtualenvs/sockapp/local/lib/python2.7/site-packages/tornado/iostream.py", line 355, in _handle_read
    if self._read_to_buffer() == 0:
  File "/home/ml/envs/.virtualenvs/sockapp/local/lib/python2.7/site-packages/tornado/iostream.py", line 422, in _read_to_buffer
    chunk = self._read_from_socket()
  File "/home/ml/envs/.virtualenvs/sockapp/local/lib/python2.7/site-packages/tornado/iostream.py", line 403, in _read_from_socket
    chunk = self.socket.recv(self.read_chunk_size)
error: [Errno 104] Connection reset by peer
subject disconnection from: None
Message handled in: 0 ms
INFO:root:200 GET /sockjs/369/rpf1d1vl/htmlfile?c=_jp.aepnvri (127.0.0.1) 60006.30ms

最后一个错误似乎是超时。当我关闭 IE9 中的警告对话框时,连接似乎打开了,但之后没有从浏览器收到消息(浏览器应该在连接打开后立即发送消息)。我想知道这是否与之前的混合内容警告有关。

【问题讨论】:

    标签: https internet-explorer-9 tornado sockjs


    【解决方案1】:

    我认为我们能够在 SockJS 邮件列表中发现您的问题。快速回顾:

    问题 1 - 您的服务器要求客户端仅使用执行 cookie 的传输(出于负载平衡原因),这意味着无法使用基于 XDR 的传输(XDR 无法执行 cookie)。

    问题 2 - 您忘记在服务器端设置 sockjs_url 参数,以包含来自 https(而不是 http)的 sockjs javascript。这就是为什么您会收到混合内容警告。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-24
      • 2012-11-13
      • 1970-01-01
      • 1970-01-01
      • 2021-03-17
      • 2017-09-17
      • 1970-01-01
      相关资源
      最近更新 更多