Accessing repetier-server through ngrok

Hi,
I'm trying to connect to a local (of course) repetier-server through a tcp tunnel. In using a standard remote ssh tunnel I get connection to server. Instead, when I try to use ngrok tcp tunnel it doesn't work fine. I've already tested using ngrok tcp tunnel to even encapsulate ssh traffic so it doesn't seem a problem of ngrok mangling the stream.  

Let me explain:

I am able to connect to 127.0.0.1:3344 through both tunnels. When connected by ngrok tcp tunnel, I get web main page, images and so but a banner pops up with message "Connection lost" _continiuosly_.
When connected by ssh tunnel, the very first attempt to open websocket connection pops up the same banner _but_ it is displayed once. Less a second later connection seems to be recovered and all is working. 


I analyzed traffic and found out error happens as requesting the websocket.

Here, headers from request through a regular ssh tunnel:

GET /socket/?lang=en&sess=!%23A%5EehC9QOAiiv%25l!UD%23!goHFwvBeGgo HTTP/1.1
Host: mytesthost.com:11000
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: es-ES,es;q=0.8,en;q=0.6
Cookie: _ga=GA1.2.155945040.1462660236
Sec-WebSocket-Key: qWL9Lc7wi+lCrNm5mIeIkA==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

An here, from a ngrok tunnel.

GET /socket/?lang=en HTTP/1.1
Host: 0.tcp.ngrok.io:13459
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: es-ES,es;q=0.8,en;q=0.6
Sec-WebSocket-Key: Xxg6EQg1QLlhma1WiA6lOw==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

As you can see, the main difference is the missing param "sess=" at ngrok request. I guess request for websocker is built by JS code at 127.0.0.1:3344.

Is there some known issue at this? Why does a standard tcp tunnel work but the same tcp tunnul by ngrok fail? Maybe some with response delay?


I'd thank any help or cue you could offer me.

Best regards.


Comments

  • It's not sess. In fact websockets create session. If you provide a session you had a connection remembered and you are trying to reconnect with same credentials.

    Websocket is started from javascript, but I have the feeling the ther server poco library may have short timeouts during connection. Especially on slower connections I see it more often timeout before going stable. I think I will check the library code for a timeout.

    Does ngrok also show/hide timeout ordoes it stay open?

    BTW: Looks like a interesting service, will try it soon and see if it works for me or if there is something I can do to get it working.
Sign In or Register to comment.