在IIS中,它能阻止虚假的API调用吗?昨天,我被一些东西淹没了,这些东西想看看网站上是否有网页。他们得到了404,但是应用程序仍然需要检查这是否是应用程序中的一个好页面。IIS能停止这种情况吗?或者web应用程序需要处理它并停止它吗?在IIS中是否有我可以添加伪路径来阻止此操作的部分?这是否有助于https://docs.microsoft.com/en-us/iis/configuration/system.webserver/security/requestfiltering/denyurlsequences/或反向代理使用IIS重写它只会传递设置的通信量?
伪API调用
The controller for path '/bitrix/admin/' was not found
The controller for path '/cgi-bin/webcm'
The controller for path '/admin' was not found
The controller for path '/system/login'
The controller for path '/typo3/phpmyadmin/'App日志文件
2021-08-17 15:05:28,382 [16] ERROR HTI.LogServices.Implementation.Log4NetHelper - [undefined]: Unhandled Exception (System.Web.HttpException (0x80004005): The controller for path '/admin' was not found or does not implement IController.
at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)发布于 2021-08-22 18:28:49
正如您已经提到的,IIS的请求筛选应该能够帮助您。
您正在使用asp.net MVC站点,因此任何请求的URL都会根据所有配置的路由进行检查。这意味着您的应用层被用来对请求进行404响应。
理想情况下,在调用应用程序层之前,您需要请求管道中的404。
有几种选择:
<system.webServer>
<security>
<requestFiltering>
<denyUrlSequences>
<add sequence="/system/login" />
</denyUrlSequences>
<hiddenSegments>
<add segment="system" />
</hiddenSegments>
<filteringRules>
<filteringRule name="systemLogin" scanUrl="true" scanQueryString="false">
<denyStrings>
<add string="system/login" />
</denyStrings>
</filteringRule>
</filteringRules>
</requestFiltering>
</security>
</system.webServer> 你应该围绕哪一个最适合你,而不影响你自己的应用程序。
如果启用失败的请求跟踪,则可以看到在管道中创建404响应的位置。在我使用不使用请求过滤的测试中,404是在管道中的232位置创建的,使用请求过滤,它是在72位置创建的,在调用应用程序层之前非常早。
是的,在IIS服务器前面设置一个web防火墙会更好,但是IIS无法在这些请求到达您的应用程序之前检测到它们。
确保您的自定义错误页配置正确,除了404,不要说任何其他的话。
https://serverfault.com/questions/1075084
复制相似问题