I would like to remotely work on (or develop) a React application, but still check the results in a local browser. Using npm, on the remote server, I launch
npm start
in order to start the application.
It returns
Server running at http://localhost:1234
Then, locally, I can access to the application in my browser at the address machineIP:1234 where machineIP is the IP address of the remote host. This looks convenient, but I do not want to expose my application to the entire world.
I am actually very surprised that the port 1234 is suddenly open to anyone. Maybe this is a configuration of my remote server under Ubuntu 19.04.
I see two potential directions:
- Can I prevent the port 1234 to be opened to the outside? And then open an SSH tunnel from my local host to the remote host on the (now private) port 1234?
- I could restrict the access to the application with a password, but after every restart of the application (because it is being modified on the server), I might have to log in every time.
How would you proceed to privately check your application (in your local browser) while it is running (and being constantly restarted) on a remote server?