简体   繁体   English

使用反向代理运行的NodeJS服务器

[英]NodeJS server running with a reverse proxy

I really fail to think of the right name for this question. 我真的没想到这个问题的正确名称。 So I'm going to explain the scenario and if someone comes with a good name, please Edit the post or comment it below so I can edit it. 因此,我将解释这种情况,如果有人有一个好名字,请编辑帖子或在下面对其进行评论,以便我进行编辑。

As far as I understood one of the pluses in running NodeJS with a reverse proxy is that the actual app that does the work stays out of the world and the port that the app is running could be closed for the outside world. 据我所知,使用反向代理运行NodeJS的优点之一是,可以正常工作的实际应用程序不会出现在外界,并且该应用程序正在运行的端口可能会与外界隔离。 (Let's say the nodejs server is running on port 3000). (假设nodejs服务器在端口3000上运行)。

So the only way to access the app is through the proxy that will be running on a port that's open for the world. 因此,访问该应用程序的唯一方法是通过将在对世界开放的端口上运行的代理。

My question is what if the app wants to make a request (POST for example) to API on another server (not running in the local network). 我的问题是,如果应用程序要向另一个服务器(不在本地网络中运行)上的API发出请求(例如POST),该怎么办。 Should that request go through the proxy again or it could be directly made by the app itself? 该请求应该再次通过代理还是可以由应用程序本身直接发出? Does the fact that the port the app is running is closed for external access make it impossible to communicate with the outside world at all? 应用程序正在运行的端口已关闭以供外部访问的事实,是否根本无法与外界通信?

I am not sure I understood your question, but yes, you can make requests to the outside world from your Node app. 我不确定我是否理解您的问题,但是可以,您可以从Node应用程序向外界提出请求。
Exposing :3000 is only used to access the app itself, but from the app you're free to make any requests. 暴露:3000仅用于访问应用程序本身,但是您可以从应用程序中自由进行任何请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM