A Web proxy lets you centralize all the access to a certain URL and prettify the address (e.g.
ec2-54-247-321-151.compute-1.amazonaws.com --> demo.gethue.com).
Here’s a sample configuration we use on our servers. We know the Apache web server pretty well so we went for it. We even configured the server to display a custom error page in case the Hue server is down/not working.
What you need to do is to install and enable the
mod_proxy module (e.g.
a2enmod proxy_http) and then configure the main virtual host (on Ubuntu it’s
/etc/apache2/sites-available/000-default.conf) to just proxy and reverse proxy any request to your Hue instance (and any HTTP 503 error to another path):
<VirtualHost *:80> ProxyPreserveHost On ProxyPass /error/ http://localhost:81/error/ ProxyPassReverse /error http://localhost:81/error/ ProxyPass / http://_HUE_INSTANCE_IP_:8888/ connectiontimeout=15 timeout=30 ProxyPassReverse / http://_HUE_INSTANCE_IP_:8888/ SetEnv proxy-nokeepalive 1 ErrorDocument 503 /error/ ServerName demo.gethue.com </VirtualHost>
demo.gethue.com with your qualified server name available on your internal or external DNS.
and then add an additional virtual host (running on a different port, 81 for instance, on
/etc/apache2/sites-available/001-error.conf) to serve the error path you specified in the default vhost:
<VirtualHost *:81> DocumentRoot /var/www/ </VirtualHost>
/var/www you need to have a folder
error with an
index.html inside (need inspiration? look here!) that is going to be displayed when Hue is not reachable.
The last thing we need to do is to tell Apache we are listening to the port 81 as well, so edit
/etc/apache2/ports.conf and just add
After everything, let’s restart Apache with
sudo service apache2 restart and… et voila! You are good to go!