Redirect 域从Domain.com/pathA重定向到domainA.com

Redirect 域从Domain.com/pathA重定向到domainA.com,redirect,iis,dns,url-redirection,http-redirect,Redirect,Iis,Dns,Url Redirection,Http Redirect,我有一个IIS web服务器,可以处理所有到*.myapp.com的请求。我们还有一些客户已经设置了自定义域,例如custom.customer.com作为customer.myapp.com的CNAME 我需要处理以下事项: 对custom.customer.com/pathA的请求需要重定向到a.internal-app.com 对custom.customer.com/pathB的请求需要重定向到b.internal-app.com 我现在的问题是,这不能在DNS级别上完成,因为它涉及路径

我有一个IIS web服务器,可以处理所有到*.myapp.com的请求。我们还有一些客户已经设置了自定义域,例如custom.customer.com作为customer.myapp.com的CNAME

我需要处理以下事项:

对custom.customer.com/pathA的请求需要重定向到a.internal-app.com 对custom.customer.com/pathB的请求需要重定向到b.internal-app.com 我现在的问题是,这不能在DNS级别上完成,因为它涉及路径。另外,无论重定向是什么,我都希望客户机始终看到他的自定义域。就像他不应该看到internal-app.com或myapp.com一样


这在任何方面都是可能的吗?

使用反向代理是可能的

1您需要为IIS安装和

2启用ARR。在应用程序请求路由页面上,选择启用代理

3创建重写规则

    <rewrite>
        <rules>
           <rule name="rewrite custom.customer.com/patha" stopProcessing="true">
                <match url="patha" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{HTTP_HOST}" pattern="^custom.customer.com$" ignoreCase="true" />
                </conditions>
                <action type="Rewrite" url="http://a.internal-app.com/" />
            </rule>
           <rule name="rewrite custom.customer.com/pathB" stopProcessing="true">
                <match url="pathb" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{HTTP_HOST}" pattern="^custom.customer.com$" ignoreCase="true" />
                </conditions>
                <action type="Rewrite" url="http://b.internal-app.com/" />
            </rule>
        </rules>
    </rewrite>
另外,您的资源可能有问题图像、样式、css和js。因为html可能包含指向资源的绝对路径

当作者创建用于修复相对URL的出站规则时,您可以查看此帖子