【问题标题】:Node.js on the same port with apache,proxy pass not workingNode.js 在与 apache 相同的端口上,代理传递不起作用
【发布时间】:2013-01-17 06:25:29
【问题描述】:

这是我的虚拟主机

名称虚拟主机 *:8080

<VirtualHost mysite.org:8080>
     ServerAdmin panda@gmail.com
     ServerName localhost
     ServerAlias www.mysite.org

     ProxyRequests off

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

     <Location />
           ProxyPass http://mysite.org:8081/
           ProxyPassReverse http://mysite.org:8081/
     </Location>
     DocumentRoot /Users/panda/Dropbox/www/_playground/node
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

现在从我的 apache 应用程序中,如果我尝试链接这样的脚本文件:&lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt; 不起作用,我需要这样做:&lt;script src="http://mysite.org:8081/socket.io/socket.io.js"&gt;&lt;/script&gt;

我做错了什么?

【问题讨论】:

    标签: php apache node.js virtualhost


    【解决方案1】:

    尝试使用 xhr-polling 作为传输,websocket 不太可能通过 apache 代理工作

    socketio.set("transports", ["xhr-polling"]);
    

    【讨论】:

    • 我认为你是对的,但我认为 socketsio 会检测到这一点并回退到长轮询或 commet ——好吧,我猜这发生在浏览器上。
    猜你喜欢
    • 2013-11-14
    • 2021-05-29
    • 2021-05-03
    • 2016-03-17
    • 2013-10-29
    • 2018-01-14
    • 2013-03-09
    • 2018-10-16
    • 1970-01-01
    相关资源
    最近更新 更多