是否可以在云中部署 Web 应用程序并对其进行配置,使其显示为公司 URL 中的子文件夹。 例如
www.mycompany.com //main company web site
www.mycompany.com/products // hits a web application in the cloud (azure for example)
谢谢
最佳答案
考虑到使用子域和 CNAME 更容易,我认为您正在寻找的是 IIS URL Rewrite module 。 以下基本规则取自this IIS Forum's thread ,描述了类似的情况并给出了示例规则。您可以使用它们作为基础:
<system.webServer>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule">
<match url="(.+)/(.*)" />
<conditions>
<add input="{HostToRedirect:{HTTP_HOST}/{R:1}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="http://{C:1}/{R:2}" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="HostToRedirect">
<add key="domain.com/mail" value="mail.domain.com" />
<add key="domain.net/mail" value="mail.domain.net" />
</rewriteMap>
</rewriteMaps>
</rewrite>
</system.webServer>
您还可以查看this SO question ,因为它为您尝试解决的问题提供了一些指南。
更新解决方案
这完全可以通过URL Rewrite module for IIS来实现。与 ARR module 结合。然后,您需要设置一个反向代理规则,将所有/products 请求重写到云中相应的 Web 应用程序。你的规则看起来像这样:
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(^products)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="{C:1}://myvompany.cloudapp.net/" />
</rule>
</rules>
</rewrite>
</system.webServer>
您可以稍后调整它以满足您的确切需求,但通过上面的示例,我刚刚实现了您正在寻找的东西。
关于http - 云中的 Web 应用程序作为主要公司 URL 的子文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11634446/