简体   繁体   中英

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.

It randomly throws 400 Bad Request error for same Web API calls that worked a second ago. Initially deleting cookies and clearing cache would fix these errors, but since the past few days, even that doesn't work.

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.

Also, this happens only on a QA environment (load balanced with 2 boxes) but not on any other environments.

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.

The issue was large cookie size resulting from too many claims that I was storing in it. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM