You may have noticed that regular port forwarding doesn’t work when trying to connect to your torrent server’s webUI if the torrent server is connected to a VPN. You can get around this limitation if you have an extra server with Apache installed using Apache’s mod_rewrite engine.
I’m going to assume that you have the following already setup and working:
- A torrent server (torrents01) with a working web interface accessible on http://10.10.10.100:8080
- An Apache web server accessible externally (web01 – IP of 10.10.10.99)
- You’re running Linux (this will work with Windows, but you’re going to have to fill in the blanks on the steps in IIS or Apache)
In web01, log in to the shell environment.
Create a new virtual host:
$ sudo nano /etc/apache2/sites-available/torrent-proxy
In the window, paste the following:
RewriteRule ^(.*)$ http://10.10.10.100:8080/$1 [P]
Now, what the above is doing is receiving all traffic on port 80 with a web address of deluge.domainname.com and rewriting the address to the local IP address of your torrent server.
Press CTRL+X and then yes to save.
Enable the above by typing:
$ sudo a2ensite torrent-proxy
Restart apache2 (reload doesn’t always work, so restart is sometimes better):
$ sudo service apache2 restart
As a note to the above, if you want to be able to use the same address internally and externally, you’ll need to add deluge.DOMAINNAME.com to your DNS server and have it point to the Apache server (DNSmasq if you are using it).
Also, utorrent is a bit of a pain in the ass with the /gui it adds at the end. The best thing to do is to change the virtual host to listen on port 8080 so that you can consistently address it. You’ll need to edit the ports.conf (/etc/apache2/ports.conf) and add port 8080 to the listening ports.
There you have it, you should now be able to get to your torrent server inside and outside of your network using the same address.