bash-3.2$ hostname
remoteserver1
bash-3.2$ telnet myservice.com 443
Trying 191.172.172.133...
Connected to myservice.com.
Escape character is '^]'.
GET / HTTP/1.0
HTTP/1.1 302 Moved Temporarily
Server: Oracle-iPlanet-Web-Server/7.0
Date: Tue, 17 Jul 2018 14:04:20 GMT
Location: https://myservice.com:443/
Content-length: 0
Connection to myservice.com closed by foreign host.
But, when I try the telnet command locally [from the same server where https://myservice.com:443/ service is running] it closes the connection even before I could get the response output of the GET command as shown below:
bash-3.2$ hostname
localserver1
bash-3.2$ telnet myservice.com 443
Trying 191.172.172.133...
Connected to myservice.com.
Escape character is '^]'.
GET / HTTP/1.0
Connection to myservice.com closed by foreign host.
So, like you can see above the connection gets closed even before the GET command could return any output.
Please share a fix so that I can fire the GET command before the telnet connection closes.
if you are doing it locally, then you must either use a local ip address, or add myservice.com to your local dns server so that it resolves to the local ip address.