ssh -i ~/.ssh/ubuntu_box_key.pem [email protected]
- Configure inbound connection rules for the security group associated with the EC2 instance to allow all traffic for the SSH (20), HTTP (80), and HTTPS (443) ports. Also add a Custom TCP Rule for port 8080 to allow all incoming traffic.
- Outbound connection rules should allow all traffic.
- Add this to /etc/ssh/sshd_config:
AllowTcpForwarding yes
GatewayPorts yes
- Setup the ssh tunnel between port 8080 on the remote server and port 5050
on the local machine:
ssh -v -i ~/.ssh/ubuntu_box_key.pem -R 8080:localhost:5050 [email protected]
- To test the connection, setup netcat to listen on port 5050:
netcat -l -p 5050
And then send some text via TCP to port 8080 of the remote server:echo “Please work, please work...” | nc -v 18.236.68.125 8080
The terminal with the netcat listener will receive and log text when the connection is successful. - Once the above test passes, fire up the proxy with
node app.js
and fire a request off tohttp://18.236.68.125:8080
.
- Start proxy server:
node app.js
- Start ssh tunnel:
ngrok http 5050
- https://github.com/nodejitsu/node-http-proxy
- http-party/node-http-proxy#1083
- https://dashboard.ngrok.com/get-started#
- https://medium.com/botfuel/how-to-expose-a-local-development-server-to-the-internet-c31532d741cc
- http://www.randomshouting.com/2013/03/21/How-to-expose-your-server-to-the-Internet.html