0

我们在 Azure 中的 VM 上托管了一个应用程序,该应用程序位于 WAF 后面,但对于某些用户来说,我们遇到了很多麻烦。

有些用户被 HTTP 错误 400 困扰。请求头的大小太长。该应用程序受 Azure AD 登录保护。

对浏览器的完整响应是:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
{
    "data": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">\r\n<HTML><HEAD><TITLE>Bad Request</TITLE>\r\n<META HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=us-ascii\"></HEAD>\r\n<BODY><h2>Bad Request - Request Too Long</h2>\r\n<hr><p>HTTP Error 400. The size of the request headers is too long.</p>\r\n</BODY></HTML>\r\n",
    "status": 400,
    "config": {
        "method": "GET",
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "url": "api/datacontext/workbooks/876dac86e00e42878d9e239a8efb00a3/session/start",
        "headers": {
            "Accept": "application/json, text/plain, */*",
            "x-invision-app-language": "EN",
            "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImFQY3R3X29kdlJPb0VOZzNWb09sSWgydGlFcyIsImtpZCI6ImFQY3R3X29kdlJPb0VOZzNWb09sSWgydGlFcyJ9.eyJhdWQiOiI2MGMyZDcwNi02M2JmLTRhYzItOGQyZi01M2QzMzM1ZTAwMDIiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC80M2I0MWVlMy01MDllLTRmNDYtOTFmZi1hYWMxNGY5MjAwYTAvIiwiaWF0IjoxNTY5NTg0NTIyLCJuYmYiOjE1Njk1ODQ1MjIsImV4cCI6MTU2OTU4ODQyMiwiYWNyIjoiMSIsImFpbyI6IkFTUUEyLzhNQUFBQWtlMDNycUJycmJoZlNBdDB4SnY4bkF4RzA1V1VPdnd4SjZDUmdVeFdkeGc9IiwiYW1yIjp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Iopdq_zmFQ6XnUmcjg"
        },
        "withCredentials": true
    },
    "statusText": "Bad Request"
}

该错误出现在应用程序的不同路径上,并且看似随机出现。它可能会在一段时间内正常工作,然后用户再次收到错误消息。我们已将问题缩小到对 WAF 的处理,因为当我们将流量更改为直接流向 IIS 网络服务器时,用户没有看到任何这些错误。似乎没有地方可以更改我可以在 WAF 中找到的请求标头的大小限制。有人知道从哪里开始寻找解决方案吗?

Azure WAF 配置如下:

配置

Tier: WAF
Firewall Status: Enabled
Firewall mode: Detection

There are no exclusions configured. 

Global Parameters: 
Inspect request body: Off

规则

Rule set: OWASP 3.0
Advanced rule configuration: Disabled
4

0 回答 0