简体   繁体   English

通过ISAPI或URL重写通过IIS公开Java Web应用程序

[英]Exposing Java web application via IIS through ISAPI or URL rewrite

I want to expose a Java application via IIS. 我想通过IIS公开Java应用程序。 I found an answer in Running a java web application in IIS that refers to the isapi redirector . 我在运行IIS中引用isapi重定向器 的Java Web应用程序时找到了一个答案。 However what also seems to work for me is to set up IIS URL rewriting rules. 但是,对我来说似乎还行得通的是设置IIS URL重写规则。 Eg I have set up a rewrite rule that matches ^java/(.*) and rewrites it to http://localhost:8080/{R:1} 例如,我设置了一个匹配^java/(.*)的重写规则,并将其重写为http://localhost:8080/{R:1}

I am a programmer and not a web server administrator, so I do not understand the implications of one versus the other. 我是一名程序员,而不是Web服务器管理员,所以我不理解一个与另一个相对的含义。 Which is the preferred approach and why? 首选方法是什么,为什么? URL rewriting seems simpler to setup since it involves less 'moving parts' and less configuration. URL重写似乎更易于设置,因为它涉及较少的“活动部件”和较少的配置。

In my experience I've had to use the ISAPI redirector when the following conditions are met: 以我的经验,当满足以下条件时,我必须使用ISAPI重定向器:

  1. Company/System policy doesn't allow to expose another HTTP port on the server (ie 8080/tcp), and IIS already owns 80/tcp, so another server can not be bound to this or any HTTP port. 公司/系统策略不允许在服务器上公开另一个HTTP端口(即8080 / tcp),并且IIS已经拥有80 / tcp,因此不能将另一个服务器绑定到该端口或任何HTTP端口。 In this case IIS and the Java server communicate through the AJP port, and the workers files have to be configured to redirect only to the context of the Java application. 在这种情况下,IIS和Java服务器通过AJP端口进行通信,并且必须将worker文件配置为仅重定向到Java应用程序的上下文。
  2. [Optional] For performance reasons, static content (html, js, css, jpg, ...) has to be hosted on IIS and only the dynamic content is left for the Java server. [可选]出于性能原因,静态内容(html,js,css,jpg,...)必须托管在IIS上,而动态内容仅留给Java服务器。 Again this calls for some careful workers configuration and selective deployment of content on each servers. 同样,这要求在每个服务器上进行一些认真的工作人员配置和内容选择性部署。

If you don't have to meet any of these conditions, and if Company/System policy doesn't enforce that all requests go through IIS, then a URL rewriting rule is probably OK. 如果您不必满足这些条件中的任何一个,并且如果公司/系统策略不强制所有请求都通过IIS,则URL重写规则可能是可以的。

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

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