← Back to team overview

graphite-dev team mailing list archive

reverse proxy Graphite Browser to a different URL and port

 

I've a monitoring "dashboard" type of system where several components are running, each with its own Web UI: Graphite, Uchiwa, Flapjack, etc. Most of these things tend to bind to http://localhost:<some-port> or maybe to http://*:<some-port>

I am trying to bring them all together under the same umbrella: an Apache instance with authentication at the top level, doing reverse proxy for each component. This is surely better than having many different software entities each doing its own different thing with regards to authentication and access control.

Examples of reverse-proxy mapping:

http://*:80/uchiwa/   on main Apache, proxied to http://localhost:3000/
http://*:80/flapjack/ on main Apache, proxied to http://localhost:3080/

These Web apps all have their own little oddities, and might require a small amount of trial and error to make them cooperate with the Apache reverse proxy, as seen in these discussions:

https://groups.google.com/forum/#!topic/flapjack-project/dLrcr0Moevk

https://github.com/sensu/uchiwa/issues/131

Now, I've tried to do the same thing with the Graphite Browser. Keep in mind, the Browser itself is running on the main Apache server here, enabled via this config:

################################
Listen 8080

<VirtualHost *:8080>

Header set Access-Control-Allow-Origin "[REDACTED]"
Header set Access-Control-Allow-Methods "GET, OPTIONS"
Header set Access-Control-Allow-Headers "origin, authorization, accept"

WSGIDaemonProcess _graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 user=_graphite group=_graphite
WSGIProcessGroup _graphite
WSGIImportScript /usr/share/graphite-web/graphite.wsgi process-group=_graphite application-group=%{GLOBAL}
WSGIScriptAlias / /usr/share/graphite-web/graphite.wsgi

Alias /content/ /usr/share/graphite-web/static/
<Location "/content/">
	SetHandler None
</Location>

ErrorLog ${APACHE_LOG_DIR}/graphite-web_error.log

</VirtualHost>
################################

It is then used by a Grafana instance to pull data out of Graphite and display it. ElasticSearch keeps the Grafana scratchpad data. That works fine.

But then I tried to reverse proxy the Graphite Browser UI, like this:

http://*:80/graphite-browser/ ==> http://localhost:8080/

I made another config file, which then was included in <VirtualHost *:80>, with this content:

################################
ProxyPreserveHost On
ProxyHTMLEnable On
ProxyHTMLExtended On

ProxyPass /graphite-dashboard/ http://127.0.0.1:8080/
ProxyPassReverse /graphite-dashboard/ http://127.0.0.1:8080/
ProxyHTMLURLMap http://127.0.0.1:8080/ /graphite-dashboard/
################################

That didn't work. I got this error from <VirtualHost *:80>:

###############
Not Found

Not Found

The requested URL /composer/ was not found on this server.
###############

So I added these lines:

################################
ProxyPass /graphite-dashboard/composer/ http://127.0.0.1:8080/composer/
ProxyPassReverse /graphite-dashboard/composer/ http://127.0.0.1:8080/composer/ ProxyHTMLURLMap http://127.0.0.1:8080/composer/ /graphite-dashboard/composer/
################################

But I got the same error.

I'm officially out of ideas at this point. Any clues, please? Thanks.

--
Florin Andrei
http://florin.myip.org/