Advantages of a reverse proxy in front of Node.JS

前端 未结 3 2096
暗喜
暗喜 2020-12-04 15:18

What are the advantages of having nginx or another web-server running as a reverse-proxy in front of the Node.JS? What does it provide?

(This question is intended fo

3条回答
  •  青春惊慌失措
    2020-12-04 15:59

    Having a more mature software as proxy is better for security and reliability. Nginx, Apache and others have been tested against a multitude of cases and used in production for years.

    You can also use features from these web server that otherwise you would have to implement yourself or use a node.js module. Like caching, statistics, balancing, etc.

    On the other side you would lose some features from node.js, realtime features like websockets (on port 80, you can still use other ports), page buffering and depending on the reverse proxy used, control over your caching and headers.

    Edit:

    • NginX now supports websocket proxying and possibly others.
    • Apache has a module to proxy websockets.

提交回复
热议问题