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