HTTP 400 can be cause because of various reasons, and HTTP 400 means there is something in the request which does not adhere to the Server handling this request.
One possible reason could be the length of Headers.
Various Servers might have a configurations set to limit this length, and if the size of the Cookie header goes beyond this limit, it will reject the error with an HTTP 400.
The solution to this is to increase the allowed length of the incoming headers to allow the requests to go through. Various servers will have specific instructions to increase this.
Apache HTTP Server has the following configuration in httpd.conf which sets this length: