I am running a Django application on my laptop at port 8000. The app works locally and I want to make it accessible to others over the internet via SSH remote port forwarding to a VPS.
I’ve connected to my VPS using the following command:
ssh -R 9090:localhost:8000 remote_user@remote_host
I tried to confirm that the port forwarding works:
netstat -tunl | grep 9090
tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN
tcp6 0 0 :::9090 :::* LISTEN
I can use telnet on the VPS to connect to port 9090 and issue a GET
request to retrieve the home page. This part works as expected. However, when I try to open the application in a browser using http://remote_host:9090
, it does not load and I get a 503 error.
I have already added a rule to the INPUT chain of iptables on my VPS to allow incoming connections to port 9090:
sudo iptables -A INPUT -p tcp --dport 9090 -j ACCEPT
I’ve temporarily uninstalled iptables on my laptop.
My questions are:
- Am I missing something in my setup that prevents the application from being accessible over the internet?
- Was I wrong to assume that this method would make my app accessible over the internet without actually deploying it?