I'm trying to use tcpserver from ucspi-tcp to launch a script that returns a simple web page. My script (hello.lua) is as follows:
#!/usr/bin/env lua
print([[HTTP/1.1 200 OK
Content-Type: text/html
<html>
<head>
<title>My title</title>
</head>
<body>
<h1>Hello in big font</h1>
</body>
</html>]])
I launch it with tcpserver -v -rh 0 9000 /path/to/hello.lua
When I use tcpcat myserver 9000, I get the expected return:
HTTP/1.1 200 OK
Content-Type: text/html
<html>
<head>
<title>My title</title>
</head>
<body>
<h1> Hello in big font</h1>
</body>
</html>
However, when I try to use a webbrowser and point to http:\\myserver:9000, I get a browser error (in Chrome) Error 101 (net::ERR_CONNECTION_RESET): Unknown error, even though the tcpserver logging shows a transaction:
tcpserver: status 1/40
tcpserver: pid 21672 from <ip address of browser>
tcpserver: ok 21672 <server hostname>::::ffff:<server ip>:9000 <client hostname>::::ffff:<client ip>::3133
tcpserver: end 21672 status 0
I know I'm missing something basic here, but I can't put the pieces of the puzzle together. Any insight is appreciated! Thanks!