【发布时间】:2018-09-10 12:12:02
【问题描述】:
我将 node js express 与 socket.io 和 apache 一起用于我的反向代理。下面是我的反向代理配置。
ProxyPass /chatApp http://localhost:3000/
ProxyPassReverse /chatApp http://localhost:3000/
所以,https://server.com/chatApp 将访问我的应用程序。下面是我的 html 中如何定义套接字。
var socket = io("https://server.com/chatApp")
浏览器抛出以下错误。
GET https://server.com/socket.io/?EIO=3&transport=polling&t=M9zVwUq 404 (Not Found)
但是,当我在浏览器中点击以下 URL 时,我得到了一些结果。
https://server.com/chatApp/socket.io/?EIO=3&transport=polling&t=M9zVwUq
尽管我在 html 中提到了 /chatApp(在定义套接字变量时),但我的应用程序并未调用 server.com/chatApp/socket.io/?EIO.. ... 它在 URL 中跳过了 chatApp,只调用了 server.com/socket.io/?EIO...
我已尝试解决此post。没有运气。
【问题讨论】: