Solution to nginx reverse proxy web page opening with random characters

Source: Internet
Author: User

Problem Background:

Today, when testing a website, we found that there would be a random 4-Character appearance in the first part of the webpage. There is no problem in accessing the general page through reverse proxy, in addition, this type of problem only occurs on the page after nginx reverse proxy and does not appear on the original Apache page.


Read the relevant information to learn:

For any problematic page, the transmission mode is chunked ("Transfer-Encoding: chunked ").

The hexadecimal number (chunk length) of the header and the zero (chunk termination) at the end of the header are the message identifiers of the chunked transmission mode. Apache respone has only one chunk, while nginx respone has four chunks, among them, the header of 1st chunks and the additional bytes at the end of 4th chunks are the original chunk identifiers in Apache respone. The extra characters appear because nginx repeatedly performs the chunked operation on messages that have already been chunked.


Solution:

Add "chunked_transfer_encoding off;" to the server or location segment of the vhost file of the corresponding site.





This article is from the "every minute" blog, please be sure to keep this source http://sofar.blog.51cto.com/353572/1303907

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.