应用程序请求路由:为什么有些站点 return HTTP 404 有些站点没有?

Application Request Routing: Why some sites return HTTP 404 some don't?

我想使用 Application Request Routing 将负载平衡器添加到现有的 asp.net 项目。所以我让自己熟悉了这些概念并创建了一个本地 test-setup:

URL-改写规则:

在任何浏览器中多次输入 localhost 后,我可以看到负载平衡(加权循环)工作正常。它在 1. 和 2. 网站之间交替。

我面临的问题是两个网站上的 404 错误

我已经尝试过以下方法:

我不知道接下来我能做什么,所以非常感谢您的帮助。谢谢。

可以在这里找到答案:https://forums.iis.net/t/1238739.aspx?Why+some+sites+return+HTTP+404+some+don+t+

有些网站根本不支持 localhost 作为主机名,这就是找不到 localhost 的原因(错误 404),例如在 google.com

如果上面的 link 将来不起作用,请详细回答:

That is not an effective test.

What you are doing is sending the hostname of your request to the third party servers. Like Google.

So if your request is say http://example.com you are sending this to say www.google.com and the Google servers will likely reject this as you can see

Web server admins generally don't let themselves receive traffic from domain thet do not host.

If you sent a request to my servers IP with mysite.com I too would likely reject it. (Things get complex if you have wildcard sites and you allow all traffic through)

But simply showing that 404 page from Google means tour request hit there server so that implies ARR is working.

If you really wanted to test it this way have a local host file with www.google.com resolving to your servers IP. Set up a site with www.google.com as the hostheader and then you should see the correct info hitting Google. But there is no accounting for what 3rd party admins do on their side.