I have a NodeJS server running on my local machine for development purposes. By default, it uses port 1337. (I've tried a handful of other ports such as 8080, 1234, 9000, 9090, 65432 et al).
I can successfully connect to this NodeJS server from Chrome, Firefox, and Opera. But, when I try to connect with Internet Explorer 11, I see "This page can't be displayed" (see image).
I've tried a variety of "solutions" and viewed several questions/answers on this site. None of them have worked. Including:
- I've tried 127.0.0.1
- I've disabled "Protected Mode" and "Enhanced Protection Mode."
- I've added "localhost" to the Intranet Zone and Trusted Zone.
- I've disabled "Friendly HTTP messages" hoping to see more detail.
- I've tried using my machine name and DNS name.
- I've tried creating a manual entry in my hosts file for "localhost" and even "thisismyfrigginpc" using my IPv4 address.
The only success I've had is when the server runs at port 80 (
http://localhost). However, I can't develop on port 80 for a variety of reasons. I need to test my code on localhost+port (some port, any port other than 80 and 443).
Questions and answers that don't help:
- Why I can't visit http://localhost via IE?
- Chrome and Firefox can reach localhost; Internet Explorer 9 can't. Why?
- How to test local sites in Metro IE10?
BTW, Running Windows 7 Enterprise 64-bit. Corporate deployment, but I have admin rights. Network configuration is pretty standard DHCP with no NAT and no Proxy.
On recommendation from @codenoire, I installed Fiddler to see the request/response. Below are the raw request and response from IE-to-Fiddler-to-server-to-Fiddler:
GET http://localhost:1337/common/test.html HTTP/1.1 Accept: text/html, application/xhtml+xml, */* Accept-Language: en-US User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko Accept-Encoding: gzip, deflate Connection: Keep-Alive Host: localhost:1337
HTTP/1.1 200 OK Set-Cookie: _session=WRuVLmrXMtjnDJY8;expires=Wed, 15 Jan 2014 23:19:16 GMT;path=/;domain=;httponly Content-Type: text/html;charset=utf-8 Last-Modified: 1389818856000 Date: Wed, 15 Jan 2014 22:19:16 GMT Connection: keep-alive Content-Length: 128 <html> <head> <title>Connectivity Test Page</title> </head> <body> <h1>This is a test page.</h1> </body> </html>
I've tested this scenario on "clean" non-corporate Windows 7 installations with IE 11. The results are identical to my standing observations. This means that any configuration made by a corporate image of Windows can be eliminated as a cause. Also, the network configuration is fairly "vanilla."
I've tried the Internet Explorer "emulation" ideas. I created a key, "iexplorer.exe" as both DWORD and QWORD values (individually) with the values
8000, 8001, 9000, 9001, 10000, and 10001. After each, rebooted and tested again. All of these attempts produced the same results. As an aside, we need to test this code in IE11. The various compatibility code and tricks don't actually help us in the long run.
Fired up a XAMPP Apache server on port 1337. IE connects to it just fine. So, there is something about the NodeJS response that IE doesn't like and the other browsers seem to handle well. We will be investigating our NodeJS code to see what exactly it happening in the headers/content to see if anything is out of line.
Update 2014-01-27: Resolution
I just wanted to document the results. The original response included Content-Type:
text/html;charset=utf-8 and based on the correct answer, it should be:
Content-Type: text/html; charset=utf-8 with a space between the type and the charset.
Here are the results:
HTTP/1.1 200 OK Set-Cookie: _session=EshWS7xDnCeV9pXS;expires=Mon, 27 Jan 2014 18:49:21 GMT;path=/;domain=;httponly Date: Mon, 27 Jan 2014 17:49:21 GMT Last-Modified: 1389818856000 Content-Type: text/html; charset=UTF-8 Content-Length: 128 Connection: keep-alive <html> <head> <title>Connectivity Test Page</title> </head> <body> <h1>This is a test page.</h1> </body> </html>
Thanks to @harrymc for uncovering the answer.