I put a proxy on Hue

Published on 12 June 2014 in Development - 2 minutes read - Last modified on 19 April 2021

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).

Screenshot from 2014-06-11 17:46:27

Have you ever wondered how we got Hue working under a proxy on demo.gethue.com? (if you missed the Cluster setup video, here it is!)

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):

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

Change 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:

DocumentRoot /var/www/

in /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

Listen 81

After everything, let's restart Apache with sudo service apache2 restart and… et voila! You are good to go!

Screenshot from 2014-06-11 17:44:11

comments powered by Disqus

More recent stories

26 June 2024
Integrating Trino Editor in Hue: Supporting Data Mesh and SQL Federation
Read More
03 May 2023
Discover the power of Apache Ozone using the Hue File Browser
Read More