目前,我正在试图将各种技术混合到一个网站上的概念certificate,以便于迁移和增加灵活性。 这个想法是在IIS 7.5 ARR反向代理之后创build一个“mashup”网站。
目前,ARR反向代理将所有请求转发给我们的主站点。 请求如下:
client -> ARR: Get / ARR -> Server 1: Get / Server 1 -> ARR: 200: /index.htm ARR -> client: 200: /index.htm
…到现在为止还挺好。
比方说,我想添加一个新的网站(另一台服务器的根)作为我的主要网站的子网站。 一个简单的入站规则可以做到这一点:
<rule name="sub1" stopProcessing="true"> <match url="^mySubsite(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="http://server2/{R:1}" /> </rule>
现在的要求是:
client -> ARR: Get /mySubsite ARR -> Server 2: Get / Server 2 -> ARR: 200: /index.htm ARR -> client: 200: /index.htm
…还行。
问题出现在server2上的站点发送redirect(例如login页面)时。 在SharePoint的情况下,它会将用户redirect到:/_layouts/Authenticate.aspx?Source=%2F …它不存在:
client -> ARR: Get /mySubsite ARR -> Server 2: Get / Server 2 -> ARR: 301: /_layouts/Authenticate.aspx?Source=%2F ARR -> client: 301: /_layouts/Authenticate.aspx?Source=%2F client -> ARR: Get /_layouts/Authenticate.aspx?Source=%2F ARR -> client: 404: Not Found
有没有人知道一种方式编写出站规则重写从服务器2“301:/_layouts/Authenticate.aspx?Source=%2F”的响应为“301:/mySubsite/_layouts/Authenticate.aspx?Source=%2FmySubsite%2F “?
我通过使用子域来解决这个问题。 所以,而不是:
www.mydomain.com/mysite1 www.mydomain.com/mysite2
我在用着:
mysite1.mydomain.com mysite2.mydomain.com
这意味着所有相关链接和redirect仍然像以前一样工作。
如果确实需要重写位置标题, 请参阅本演练