简体   繁体   English

HTTP 400。请求头的大小太长

[英]HTTP 400. The size of the request headers is too long

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad Request</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request - Request Too Long</h2> <hr><p>HTTP Error 400. The size of the request headers is too long.</p> </BODY></HTML>

I have ac# web api along with angularjs webapp that is behaving rather weird on a deployment server.我有 ac# web api 以及在部署服务器上表现得相当奇怪的 angularjs webapp。

It randomly throws 400 Bad Request error for same Web API calls that worked a second ago.对于一秒钟前工作的相同 Web API 调用,它会随机抛出 400 Bad Request 错误。 Initially deleting cookies and clearing cache would fix these errors, but since the past few days, even that doesn't work.最初删除 cookie 和清除缓存可以解决这些错误,但自过去几天以来,即使这样也行不通。

I checked my header size, it is well within limits.我检查了我的标题大小,它完全在限制范围内。 I have 4 cookies almost 4 MB each, so that shouldn't be an issue.我有 4 个 cookie,每个几乎 4 MB,所以这应该不是问题。

Also, this happens only on a QA environment (load balanced with 2 boxes) but not on any other environments.此外,这仅发生在 QA 环境(用 2 个盒子进行负载平衡)中,而不发生在任何其他环境中。

Any suggestions?有什么建议?

EDIT: Here is the browser's response Bad Request - Request Too Long HTTP Error 400. The size of the request headers is too long.编辑:这是浏览器的响应错误请求 - 请求太长 HTTP 错误 400。请求标头的大小太长。

The issue was large cookie size resulting from too many claims that I was storing in it.问题是由于我在其中存储了太多声明而导致 cookie 大小过大。 Addressed it by reducing the number of claims (custom claims) which weren't needed and now it works fine.通过减少不需要的声明(自定义声明)的数量来解决这个问题,现在它可以正常工作。

Will need to figure out in the future, alternative ways to pass the user's claims going forward should the app indeed have that many claims.如果应用程序确实有这么多声明,将来需要找出其他方法来传递用户的声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复来自 Azure 云服务的“HTTP 错误 400。请求标头的大小太长”错误? - How to fix "HTTP Error 400. The size of the request headers is too long" error from azure cloud services? Sharepoint在线API返回:HTTP错误400。请求标头字段太长 - Sharepoint online API returns: HTTP Error 400. A request header field is too long IIS 8错误请求400。请求太长 - IIS 8 Bad Request 400. request too long webapi odata-长网址导致“ HTTP错误400。请求网址无效” - webapi odata - long url causes “HTTP Error 400. The request URL is invalid” HTTP/2 连接错误 (PROTOCOL_ERROR):请求标头太长 - HTTP/2 connection error (PROTOCOL_ERROR): Request headers too long 错误请求 - 无效 URL - HTTP 错误 400。请求 URL 无效 - Bad Request - Invalid URL - HTTP Error 400. The request URL is invalid AD Microsoft登录400错误的请求标头太长ASP.net MVC - AD Microsoft Login 400 bad request headers too long ASP.net MVC 当连接到wcf服务时,为什么会看到“HTTP错误400.请求主机名无效。” - Why do I see “HTTP Error 400. The request hostname is invalid.” when connected to a wcf service WCF ProtocolException: Bad Request 400(与 http 消息大小有关) - WCF ProtocolException : Bad Request 400 (related to http message size) 请求 URL 太长 HTTP 错误 414。请求 URL 太长 - Request URL Too Long HTTP Error 414. The request URL is too long
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM