要使 ColdFusion Websockets 在 Cloudflare 后面的 Azure VM 上工作,需要执行哪些步骤?
我们正在尝试在ColdFusion(2018.0.13.329786)中使用Websocket在我们在CloudFlare后面的Azure VM上运行的应用程序中使用。但是,我们一直在客户端遇到此错误:
WebSocket connection to 'wss://www.*************.com/cfws' failed:
CFWebSocketWrapper.open @ cfwebsocketCore.js:21
init @ cfwebsocketChannel.js:49
_cf_websockets_init_6539553945348401 @ strategies-for-devel…ing-with-impact:175
fire @ cfajax.js:1214
$E.windowLoadHandler @ cfajax.js:1321
Uncaught TypeError: Cannot set properties of undefined (setting 'readyState')
at WebSocket.wsConnection.onerror (cfwebsocketCore.js:54:29)
wsConnection.onerror @ cfwebsocketCore.js:54
error (async)
CFWebSocketWrapper.open @ cfwebsocketCore.js:53
init @ cfwebsocketChannel.js:49
_cf_websockets_init_6539553945348401 @ *************:175
fire @ cfajax.js:1214
$E.windowLoadHandler @ cfajax.js:1321
load (async)
$E.onWindowLoad @ cfajax.js:1297
cfinit @ cfajax.js:1332
(anonymous) @ cfajax.js:1834
当消息发布到服务器上的日志文件的频道中时,我们有一个CFC,而该日志文件永远不会更新。这并不奇怪,因为似乎有些东西完全阻止了连接。
从配置的角度来看,我们在创建VM时运行这些更新:
webSocketObj= createObject("component","cfide.adminapi.websocket");
webSocketObj.setProperty(propertyName="EnableWebSocketServer", propertyValue="true");
webSocketObj.setProperty(propertyName="EnableProxyPort", propertyValue="8581");
然后通过CFExecute:
#server.coldfusion.rootdir#/lib/wsproxyconfig.jar -ws IIS -site All -host localhost -port 8581
然后重新启动CF Service和IIS。
我们还启用了CloudFlare中的Websocket“ Switch”。
这应该与进入CF管理员,转到“ Websockets”选项卡,然后勾选“使用代理”,然后使用8581的默认端口。这应该从客户端的角度通过端口443上的所有内容发送所有内容。
Cloudflare和Azure说不需要特殊的配置。我们可以看到CF具有8581端口。
最令人发指的是,我们去年在开发环境中进行了此工作,经过大量的反复试验,它起作用了。但是,从那时起我们的笔记不好,当我们做以上操作以在质量检查环境中进行工作时,它就无法正常工作。显然,我们在某个地方错过了一步,但无法弄清楚。
能够得到这项工作的任何人都可以解释使ColdFusion Websockets在Cloudflare背后的Azure VM上工作需要哪些步骤?
We are attempting to use websockets in ColdFusion (2018.0.13.329786) in an app we have running on Azure VMs behind Cloudflare. However, we are continually getting this error on the client side:
WebSocket connection to 'wss://www.*************.com/cfws' failed:
CFWebSocketWrapper.open @ cfwebsocketCore.js:21
init @ cfwebsocketChannel.js:49
_cf_websockets_init_6539553945348401 @ strategies-for-devel…ing-with-impact:175
fire @ cfajax.js:1214
$E.windowLoadHandler @ cfajax.js:1321
Uncaught TypeError: Cannot set properties of undefined (setting 'readyState')
at WebSocket.wsConnection.onerror (cfwebsocketCore.js:54:29)
wsConnection.onerror @ cfwebsocketCore.js:54
error (async)
CFWebSocketWrapper.open @ cfwebsocketCore.js:53
init @ cfwebsocketChannel.js:49
_cf_websockets_init_6539553945348401 @ *************:175
fire @ cfajax.js:1214
$E.windowLoadHandler @ cfajax.js:1321
load (async)
$E.onWindowLoad @ cfajax.js:1297
cfinit @ cfajax.js:1332
(anonymous) @ cfajax.js:1834
We have a cfc that's called when a message is posted to a channel that writes to a log file on the server, and this log file never gets updated. This is unsurprising as it appears that something is preventing the connection altogether.
From a configuration perspective, we run these updates when the VM is created:
webSocketObj= createObject("component","cfide.adminapi.websocket");
webSocketObj.setProperty(propertyName="EnableWebSocketServer", propertyValue="true");
webSocketObj.setProperty(propertyName="EnableProxyPort", propertyValue="8581");
and then via cfExecute:
#server.coldfusion.rootdir#/lib/wsproxyconfig.jar -ws IIS -site All -host localhost -port 8581
and then the CF service and IIS are restarted.
We have also enabled the websocket 'switch' in Cloudflare.
This should be the same as going into CF Admin, going to the websockets tab, and then ticking "Use Proxy", and then using the default port of 8581. This should send everything through IIS on port 443 from the client perspective.
Cloudflare and Azure say that no special configuration is needed. And we can see that CF has port 8581 open.
The most infuriating thing is that we worked on this in our Dev environment last year and after much trial and error got it working. However, our notes from that time were not good and when we did the above to try to get this working in our QA environment it did not work. We're obviously missing a step somewhere, but have not been able to figure it out.
Can anyone who has gotten this working explain what steps are required to make ColdFusion websockets work on an Azure VM behind Cloudflare?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们解决了这个问题。希望这能帮助遇到同样问题的其他人:
根据此 doc,我们意识到 wsproxyconfig 应该在 IIS 中创建一个“应用程序”(如虚拟文件夹)调用 cfws 指向/config/wsproxy/1。然而,它并没有这样做。创建该应用程序后,一切都开始按预期工作。
经过进一步测试,我们发现仅当以管理员身份运行时才会创建此应用程序。否则,它报告成功并且不提供警告或失败,但不创建应用程序。
我们通过 CFExecute 从命令行运行 wsproxyconfig,因此它在管理用户下运行,但这显然还不够。因此,我们将 wsproxyconfig 调用移至我们的 PowerShell 脚本之一,并让它以管理权限运行,这解决了我们的问题。
这显然最初在我们的开发环境中有效,因为我们手动运行了 wsproxyconfig。
We solved this issue. Hopefully this will help anyone else who runs into the same problem:
Per this doc, we realized that the wsproxyconfig was supposed to be creating an 'application' (like a virtual folder) in IIS called cfws pointing to <CF_INSTALL_HOME>/config/wsproxy/1. However, it was not doing so. Once that application was created, everything started working as expected.
Upon further testing we found that it created this application only if it was run as administrator. Otherwise, it reported success and provided no warnings or failures, but did not create the application.
We were running wsproxyconfig from the command line via CFExecute, so it was running under an administrative user, but that was apparently not sufficient. So we moved the wsproxyconfig call to one of our PowerShell scripts and had it run with administrative privileges and that solved our problem.
This had apparently worked in our dev environment originally because we ran wsproxyconfig manually.