Windows 上的反向代理

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4369117/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:44:33  来源:igfitidea点击:

Reverse Proxy on Windows

windowsiisnginxjettyreverse-proxy

提问by mckamey

I have a web server that responds to a number of different sites on port 80. Currently, IIS does the mapping to various sites via host headers, but I'd like to be able to serve other web apps on port 80 hosted in Jetty or Tomcat. IIS prevents that by grabbing all port 80 traffic.

我有一个 Web 服务器,它响应端口 80 上的许多不同站点。目前,IIS 通过主机标头映射到各个站点,但我希望能够在 Jetty 中托管的端口 80 上为其他 Web 应用程序提供服务,或者雄猫。IIS 通过获取所有端口 80 流量来防止这种情况发生。

I basically need a reverse proxy to just change the port number to something that another app stack can listen in on. I was looking into nginx but it seems to not be quite ready for prime time on Windows. Eventually I may set up a Linux box specifically for this, but for now I'm interested in a solution which will run all on the same box.

我基本上需要一个反向代理来将端口号更改为另一个应用程序堆栈可以侦听的内容。我正在研究 nginx,但它似乎还没有准备好迎接 Windows 的黄金时段。最终我可能会专门为此设置一个 Linux 机器,但现在我对一个可以在同一个机器上运行的解决方案感兴趣。

All I really need is something very light which mostly just matches hostname/port and allows rewriting of the port. Does anyone have any suggestions?

我真正需要的是一些非常轻便的东西,它主要匹配主机名/端口并允许重写端口。有没有人有什么建议?

回答by Carlos Aguilar Mares

If you are running in IIS 7 or above you can use Application Request Routing for that: http://www.iis.net/download/ApplicationRequestRouting

如果您在 IIS 7 或更高版本中运行,您可以使用应用程序请求路由:http: //www.iis.net/download/ApplicationRequestRouting

回答by mckamey

For IIS 5-6, it looks like Apache Tomcat Connector (JK 1.2) is a clean solution. This is an IIS ISAPI filter which allows IIS to act as a reverse proxy for other web servers. It uses Apache JServ Protocol(AJP) to communicate with the app server actually serving requests. Both Tomcat and Jetty implement AJP. URLs are mapped with regex-like config to a particular AJP server instance.

对于 IIS 5-6,看起来 Apache Tomcat Connector (JK 1.2) 是一个干净的解决方案。这是一个 IIS ISAPI 过滤器,它允许 IIS 充当其他 Web 服务器的反向代理。它使用Apache JServ 协议(AJP) 与实际服务请求的应用服务器进行通信。Tomcat 和 Jetty 都实现了 AJP。URL 使用类似正则表达式的配置映射到特定的 AJP 服务器实例。

This ISAPI plug-in also works with IIS 7.x, but in that case the Application Request Routing (see marked answer) should be considered as it might work better with non-AJP servers.

此 ISAPI 插件也适用于 IIS 7.x,但在这种情况下,应考虑应用程序请求路由(请参阅标记的答案),因为它可能与非 AJP 服务器一起工作得更好。