Tornado 安全 websocket 超时
Tornado secure websocket timeout
我的服务器有 2 个 Ip (ip1 & ip2) 我最近添加了 ip2。当我尝试在 ip1(apache2
是 运行)上打开我的龙卷风 websocketserver 时,一切都很好,我指定了一个端口,例如22000 并且可以通过 wss://domain.tld:22000/sub
连接到我的 socket
然而,一旦我将 tornado 配置为侦听 ip2(其中 Apache 不是 运行),因为我必须使用端口 443,该端口已被阻止通过 ip1 上的 apache,我无法通过 wss://sockets.domain.tld:443/sub
连接到它。 DNS
A记录指向ip2。
The connection times out. No matter which port or protocol (wss / ws) i use.
我的 python 代码:
from tornado import web
from tornado import ioloop
from tornado import websocket
from tornado import httpserver
import ssl
import json
import random
import re
import os
application = web.Application([(r"/sub", Client)])
http_server = httpserver.HTTPServer(application, ssl_options = {
"certfile": os.path.join(LIB_DIR, "certificate.crt"),
"keyfile": os.path.join(LIB_DIR, "certificate.key"),
})
http_server.bind(443, address = "ip2")
print("Listening to ip2:443")
ioloop.IOLoop.current().start()
我的服务器 运行 Ubuntu 12.2
,我打开端口并使用外部工具检查它们是否打开。
我该如何解决这个问题?跟我的服务器有关系吗?
更新
我很确定它与 http_server.bind(...)
有关,代码确实适用于 .listen(port)
,但 ip1 和 bind 也不起作用。
根据the documentation,在调用bind
之后,您应该在服务器上调用start
。所以
http_server.bind(443, address = "ip2")
print("Listening to ip2:443")
http_server.start()
ioloop.IOLoop.current().start()
应该可以。
我的服务器有 2 个 Ip (ip1 & ip2) 我最近添加了 ip2。当我尝试在 ip1(apache2
是 运行)上打开我的龙卷风 websocketserver 时,一切都很好,我指定了一个端口,例如22000 并且可以通过 wss://domain.tld:22000/sub
socket
然而,一旦我将 tornado 配置为侦听 ip2(其中 Apache 不是 运行),因为我必须使用端口 443,该端口已被阻止通过 ip1 上的 apache,我无法通过 wss://sockets.domain.tld:443/sub
连接到它。 DNS
A记录指向ip2。
The connection times out. No matter which port or protocol (wss / ws) i use.
我的 python 代码:
from tornado import web
from tornado import ioloop
from tornado import websocket
from tornado import httpserver
import ssl
import json
import random
import re
import os
application = web.Application([(r"/sub", Client)])
http_server = httpserver.HTTPServer(application, ssl_options = {
"certfile": os.path.join(LIB_DIR, "certificate.crt"),
"keyfile": os.path.join(LIB_DIR, "certificate.key"),
})
http_server.bind(443, address = "ip2")
print("Listening to ip2:443")
ioloop.IOLoop.current().start()
我的服务器 运行 Ubuntu 12.2
,我打开端口并使用外部工具检查它们是否打开。
我该如何解决这个问题?跟我的服务器有关系吗?
更新
我很确定它与 http_server.bind(...)
有关,代码确实适用于 .listen(port)
,但 ip1 和 bind 也不起作用。
根据the documentation,在调用bind
之后,您应该在服务器上调用start
。所以
http_server.bind(443, address = "ip2")
print("Listening to ip2:443")
http_server.start()
ioloop.IOLoop.current().start()
应该可以。