http/1.1 Open Unknown error problem for Express

Source: Internet
Author: User
The architecture is this: nodejs+express, using Ejs as a template.
The error is this:
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.wvvhofhb3gyrkxnoytqbe1sggc2aeydshczilgsb%2fy0; path=/; Expires=thu, June 06:54:36 GMT; HttpOnly
Connection:keep-alive
When rendering some pages, express will put the above text in front of the text of the HTML document, some browsers (Chrome,ie) will ignore these words, looks normal. There are also browsers (Opera), will continue to wait for the return of the server, performance for the page has been rendered, but JavaScript does not perform, has been in loading until the timeout, press the stop button to normal load complete the page function. Other browsers, mostly versions of Safari, directly assume that the document is plain text, displaying the source code, as shown in the figure.
Perhaps the reason for the small Express user base, I have not been able to find the reason for this problem. After the arduous debug, finally found the reason. Here are the culprits.
Notice that, on line 192, I read the parameter named status from the URL and passed it to the Ejs template with the name status as the template parameter intact. In the Ejs template, this is used:
Tragedy happened. Change to this:
And in the Ejs to avoid the use of <%= status%>, to switch to <%= docstatus%>, the problem immediately resolved. I'm not quite sure about the wrong mechanism, I guess the status variable in Ejs's argument may be retained for another purpose. I wish you a speedy solution to the problem of http/1.1 open unknown

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.