With finally ordering a Raspberry Pi but not having recieved it yet I am testing the concept of using the Raspberry Pi as a Reverse Proxy to easily allow me access to a few devices I have at home without having to rely on running web services on different ports since I only have the 1 public IP address at home. By simply using a reverse proxy on the Raspberry Pi I can easily access kit at home using different hostnames. A quick test on a virtual machine proved the concept.
After installing apache I needed to enable to proxy module with the command:
Then simply setup the apache sites with the following info:
<VirtualHost *:80>
ServerName device1.mydomain.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://internadevice1/
ProxyPassReverse / http://internaldevice1/
</VirtualHost>
<VirtualHost *:80>
ServerName device2.mydomain.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://internaldevice2:8080/
ProxyPassReverse / http://internaldevice2:8080/
</VirtualHost> |
<VirtualHost *:80>
ServerName device1.mydomain.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://internadevice1/
ProxyPassReverse / http://internaldevice1/
</VirtualHost>
<VirtualHost *:80>
ServerName device2.mydomain.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://internaldevice2:8080/
ProxyPassReverse / http://internaldevice2:8080/
</VirtualHost>
Adding the DNS entries and testing by browsing to device1.mydomain.com and device2.mydomain.com resulted in the access to the correct internal devices.
Naturally this is just a proof of concept and needs a bit more work to ensure secure but It will mean with the Raspberry Pi I can use it as a way to easily connect to internal devices with simply having 1 port open rather than numerous ports all for different devices. With some of my devices only offering http support I can add a self signed SSL certificate to the Apache Reverse Proxy to stop any sniffing of usernames and passwords if I were just browsing http over the internet.
*Update* I have now recieved the Pi and it is working great as a reverse proxy. Running top whilst using the proxy I can see the processor usage is minimal at around 3% so even although it is a low powered device it is handling this very well.