Netdata via HAProxy
HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites and powers quite a number of the world's most visited ones.
If Netdata is running on a host running HAProxy, rather than connecting to Netdata from a port number, a domain name can
be pointed at HAProxy, and HAProxy can redirect connections to the Netdata port. This can make it possible to connect to
Netdata at https://example.com or https://example.com/netdata/, which is a much nicer experience then
http://example.com:19999.
To proxy requests from HAProxy to Netdata, the following configuration can be used:
Default Configuration#
For all examples, set the mode to http
Simple Configuration#
A simple example where the base URL, say http://example.com, is used with no subpath:
Frontend#
Create a frontend to receive the request.
Backend#
Create the Netdata backend which will send requests to port 19999.
Configuration with subpath#
A example where the base URL is used with a subpath /netdata/:
Frontend#
To use a subpath, create an ACL, which will set a variable based on the subpath.
Backend#
Same as simple example, except remove /netdata/ with regex.
Using TLS communication#
TLS can be used by adding port 443 and a cert to the frontend.
This example will only use Netdata if host matches example.com (replace with your domain).
Frontend#
This frontend uses a certificate list.
In the cert list file place a mapping from a certificate file to the domain used:
/etc/letsencrypt/certslist.txt:
The file /etc/letsencrypt/live/example.com/example.com.pem should contain the key and
certificate (in that order) concatenated into a .pem file.:
Backend#
Same as simple, except set protocol https.
Enable authentication#
To use basic HTTP Authentication, create an authentication list:
You can create a hashed password using the mkpassword utility.
Replace passwordhere with hash:
Now add at the top of the backend:
Full Example#
Full example configuration with HTTP auth over TLS with subpath: