First of all, I am trying to implement a repl server for my node.js application, I've created it with the help of this gist. everything is fine and I can connect to my repl server with this command in the localhost:
$ curl -sSNT. localhost:8000
Welcome to the Fun House
> echo me
echo me
> echo me again
echo me again
> bye
bye
> ^C
but when I try to use nginx as the reverse-proxy, this command got hanged and no output is displayed:
$ curl -sSNT. test.localhost:8083 -I
HTTP/1.1 100 Continue
It hangs forever.
Steps to reproduce the problem:
git clone https://github.com/mostafa8026/nginx-repl-curl.git
cd nginx-repl-curl
docker-compose build
- add test.localhost to your hosts
127.0.0.1 localhost test.localhost
-
docker-compose up -d
- and the main problem:
curl -sSNT. test.localhost:8083 -I
EDIT
As mentioned in the answers, we can try writing and then press Ctrl+D
, but it closes the connection, as a repl server, the main purpose is to keep the connection open and send command like in the command line like this:
$ curl -sSNT. localhost:8000
Welcome to the Fun House
> echo me
echo me
> echo me again
echo me again
> bye
bye
> ^C
not like this:
curl -sSNT. test.localhost:8083 -I
HTTP/1.1 100 Continue
echo me
HTTP/1.1 200 OK
Server: nginx/1.21.1
Date: Sat, 09 Apr 2022 12:58:37 GMT
Content-Type: multipart/octet-stream
Transfer-Encoding: chunked
Connection: keep-alive
Welcome to the Fun House
> echo me
> Ended
It hangs here
^C