In many cases it might be easier/better to just use LocalTunnel.

In this case, I didn’t want the external URL changing all the time, and I already have a Linode server setup that I can use. Here are some notes on setting it up.

Assumes a Linux server setup with SSH and Apache.

Setup the proxy

Enable the proxy modules on the server.

a2enmod proxy
a2enmod proxy_http

Edit mods-available/proxy.conf to enable the reverse proxy for requests.

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

Add a new virtual site to be the reverse proxy. Place a file like the following in the sites-available Apache directory. The localhost port doesn’t matter too much, just needs to not be in use.

<VirtualHost *:80>
     ServerAdmin dustt
     ServerName virtual.red27.net
     SetEnv proxy-initial-not-pooled 1
     ProxyPass / http://localhost:8001
     ProxyPassReverse / http://localhost:8001
     ProxyPreserveHost On
</VirtualHost>

Enamble the virtual site and restart Apache.

a2ensite virtual.red27.net

On the client

You will need to SSH into the server and reverse forward the packets back to the local server.

ssh -nNT -R 8001:localhost:3000 user@virtual.red27.net

This tunnel will need to be reset if the local server errors out. Removing the n argument may help notify you if something goes wrong.