1

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:

  1. git clone https://github.com/mostafa8026/nginx-repl-curl.git
  2. cd nginx-repl-curl
  3. docker-compose build
  4. add test.localhost to your hosts
127.0.0.1       localhost test.localhost
  1. docker-compose up -d
  2. 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
mostafa8026
  • 273
  • 2
  • 12
  • 25

1 Answers1

0

It's hanging because it's waiting for you to write something(file to be uploaded) to stdin

write something hit enter then ctrl+D

Test of answer

$ curl -sSNT. test.localhost:8083 -I
HTTP/1.1 100 Continue

Here's a test 
mostafa8026    
HTTP/1.1 200 OK
Server: nginx/1.21.6
Date: Sat, 09 Apr 2022 11:41:35 GMT
Content-Type: multipart/octet-stream
Transfer-Encoding: chunked
Connection: keep-alive

Welcome to the Fun House
> Here's a test 
mostafa8026
> Ended

Def Soudani
  • 1,151
  • 7
  • 17
  • You think I didn't do that :(. Did you try the reproduction steps? – mostafa8026 Apr 09 '22 at 04:30
  • I did I updated my answer with the output of what I said ? what happens when on your part when you follow my answer ? – Def Soudani Apr 09 '22 at 11:44
  • Thanks, Now I understand what you mean. but it is also not correct. We loses the connection. I edited my question and provide more detail. Please read it again – mostafa8026 Apr 09 '22 at 13:01