IIS 反向代理到 node.js [英] IIS Reverse Proxy to node.js

查看:21
本文介绍了IIS 反向代理到 node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置反向代理,以便从 IIS 中托管的网站对 node.js 应用程序进行的 HTTP 调用正常工作.

I am trying to configure a reverse proxy so that HTTP calls made from a website hosted in the IIS to node.js applications work.

我会更好地解释它:

我聘请了 VPS.在这个 VPS 中,我有一个 IIS 网站(简单的 HTMl + Javascript)和一个在 localhost:3000 上运行的 node.js 应用程序.在 javascript 中,我对 node.js 进行 HHTP GET 调用以获取一些数据.

I've hired a VPS. In this VPS i have a IIS website (simple HTMl + Javascript ) and a node.js application running on localhost:3000. In javascript i make HHTP GET calls to the node.js to obtain some data.

我需要配置一个反向代理,以便例如对 node.mydomain.com 的 HTTP 调用在内部重定向到 localhost:3000.

I need to configure a reverse proxy so that the HTTP calls made to node.mydomain.com for example, are internally redirected to localhost:3000.

网站的 HTTP 调用示例:

Example of website's HTTP call:

$.get( "node.mymydomain.com/balance", function( data ) {
  alert( data );
});

在与 IIS、ARR 和 URL 重写斗争 2 天后,我无法正确配置它,我相信它不应该如此复杂.

After 2 days fighting with IIS, ARR and URL rewrite I am not able to configure it properly and I believe it should not be so complicated.

这是我目前所做的:

  1. 我创建了一个名为node"的服务器群指向 127.0.0.1 并在高级设置中将 HTTP 端口从 80 更改为 3000,因为这是我的 node.js 应用程序运行的位置:

  1. 我被问到是否要创建 URL 重写规则,我点击是:

  1. 我生成以下条件:

  1. 我添加条件并将其路由到我的新节点"服务器群:

我在我的笔记本电脑 node.mydomain.com/balance 上进行了测试,但它不工作.

I tested on my laptop node.mydomain.com/balance and it is not working.

推荐答案

我终于设法使用反向代理(IIS 的 ARR 和 URL 重写)解决了这个问题,如以下指南中所述:

I finally managed to solve this using a reverse proxy (IIS's ARR and URL Rewrite) as it is explained in the following guide:

http://www.gitshah.com/2013/06/how-to-use-iis7-as-front-end-to-java.html

这篇关于IIS 反向代理到 node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆