有没有一种解决方案可以让 Node.js 充当 HTTP 反向代理?
我们公司有一个项目,现在使用 nginx 作为反向代理来提供静态内容并支持 comet 连接。我们使用长轮询连接来摆脱不断的刷新请求,让用户立即获得更新。
现在,我知道已经为 Node.js 编写了很多代码,但是有没有一种解决方案可以让 Node.js 充当反向代理,像 nginx 一样提供静态内容?或者也许有一个框架允许使用 Node.js 快速开发这样的层?
Our company has a project that right now uses nginx as a reverse proxy for serving static content and supporting comet connections. We use long polling connections to get rid of constant refresh requests and let users get updates immediately.
Now, I know there is a lot of code already written for Node.js, but is there a solution that lets Node.js act as a reverse proxy for serving static content as nginx does? Or maybe there is a framework that allows to quickly develop such a layer using Node.js?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
dogproxy 可能能够帮助您,如果不是作为一个完整的解决方案,那么可能作为一个解决方案的构建块。
但是,您可能希望重新考虑保留 nginx 来提供静态内容——它是专门针对此特定任务而设计和调整的。使用 Node.js 提供静态内容会增加大量开销 - 就像使用 PHP 提供静态文件一样。
dogproxy might be able to help you, if not as a full solution then possibly as the building blocks for one.
However, you might wish to reconsider keeping nginx for serving static content -- it is specifically designed and tuned for this particular task. You would be adding a lot of overhead in using node.js to serve static content - much like using PHP to serve static files.
node-http-proxy 听起来像你想要的
node-http-proxy sounds like what you want