HTTP/1.1 open unknown error in Express

Source: Internet
Author: User

This article will introduce the HTTP/1.1 open unknown error of Express for your reference. The architecture is as follows: NodeJS + Express, using EJS as the template.
The error is as follows:

The Code is as follows: Copy code
HTTP/1.1 open unknown
X-Powered-By: Express
Content-Type: text/html; charset = UTF-8
Content-Length: 11874
Set-Cookie: connect. sid = x4iNL4p1zGLt5mhMphHtiDFh. Capacity % 2FY0; path =/; expires = Thu, 21 Jun 2012 06:54:36 GMT; httpOnly
Connection: keep-alive
When rendering some pages, Express will put the above text in front of the HTML document body, Some browsers (Chrome, IE) will ignore the text, it looks normal. Another browser (Opera) will continue to wait for the server to return, as the page has been rendered, but JavaScript is not executed, and it will remain in Loading until it times out, press the stop key to load the page. In other browsers (mainly Safari), the document is regarded as plain text and the source code is displayed ,. Maybe it is the reason why the Express user group is small. I have never been able to find the cause of this problem. After arduous debugging, I finally found the cause. The following are the culprit. Note that in row 192, I read the parameter "status" from the URL and passed it to the EJS template using the name "status" as the template parameter. In the EJS template, the tragedy occurs. Change to this mode: Avoid using <% = status %> In EJS, and use <% = docstatus %> instead. The problem is solved immediately. I am not quite clear about the mechanism of the error. I guess the status variable may have another function in the EJS parameters. I wish you an early solution to the HTTP/1.1 open unknown issue.

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.