Bad request-request too long caused by cnzz Statistics Code

Source: Internet
Author: User

Cause

Today, a garden friend reported to us that some blog articles opened in chrome will contain "Bad request-request too long. HTTP Error 400. the size of the request headers is too long. "error page:

It's okay to use IE and Firefox, but Chrome is the only one.

We have encountered such a problem before. We thought it was caused by an accidental chrome problem, so we renamed the chrome configuration file in "% localappdata % \ google, let chrome re-configure and solve the problem.

Today, when this problem occurs again, it cannot be ignored. You must identify the real cause of the problem and find a solution.

Solution Process

At first, we speculate that it may be because Chrome's request header contains too much content. It is normal to view the URL of the chrome request, and no request header exception is found. Since the cause of the problem is not found in chrome, let's start from the server. The request length is longer, as long as the user can see the normal content.

Where does IIS on the server return this error? At first, we thought it was the request Filtering module. Adjusting the request limits settings cannot solve the problem, and disabling the request Filtering module cannot solve the problem.

Later, post on the official IIS Forum HTTP 400. the size of the request headers is too long. The error is HTTP. the request header length limit returned by sys is determined by two parameters in the Registry HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ HTTP \ Parameters: maxfieldlength and maxrequestbytes. The default values are 16384 bytes. For details, see http. sys registry settings for IIS.

To modify these two settings, You need to restart IIS (net stop HTTP, Net start HTTP, iisreset) and solve the problem on the surface, so we didn't take this method immediately. Looking back at the request header in chrome, we suddenly found that the cookie value was long.

View the cookie further:

Many cnzz_eids are generated by cnzz statistics code, but cnzz is not used in our blog. However, some blogs add cnzz statistics code. We checked some pages that would generate "Bad request-request too long", and some of them added cnzz code.

We manually deleted some cookies with cnzz_eid in chrome, and the problem was solved.

It turned out to be a fault caused by cnzz!

Why can't this problem occur in IE and Firefox?

It may be that IE and Firefox will automatically truncate requests with too long request headers, while chrome ignores this.

Summary

This article shares the following content: When IIS returns "Bad request-request too long. HTTP Error 400. the size of the request headers is too long. "error, it indicates that the length of the request header sent by the client exceeds HTTP. sys restrictions, which are determined by the two parameters maxfieldlength and maxrequestbytes in the Registry "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ HTTP \ Parameters". The default value is 16384 bytes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.