How to configure Reverse Proxy on Linux Slackware with Apache and Grafana?

The file /etc/httpd/extra/httpd-ssl.conf looks like this:

<VirtualHost _default_:443>

#   General setup for the virtual host
DocumentRoot "/srv/httpd/htdocs"
ServerName myu.com:443
ErrorLog "/var/log/httpd/error_log"
TransferLog "/var/log/httpd/access_log"

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on


<Location /grafana/>
   ProxyPreserveHost On
   ProxyPass https://127.0.0.1:3000/
   ProxyPassReverse /grafana/ https://127.0.0.1:3000/

   SSLRequireSSL
   AuthType basic
   AuthBasicProvider ldap
   AuthName "Restrict Access"
   AuthLDAPBindDN cn=apacheldap,ou=DSA,dc=myu,dc=com
   AuthLDAPBindPassword <password>
   AuthLDAPURL ldap://ldap.myu.com:389/ou=people,dc=myu,dc=com?uid?one TLS
   AuthLDAPGroupAttribute memberUid
   AuthLDAPGroupAttributeIsDN off
   Require ldap-group cn=restrictintranet,ou=groups,dc=myu,dc=com
</Location>

And in Grafana, in defaults.ini I left it like this:

protocol = https
http_addr = 127.0.0.1
http_port = 3000
domain = myu.com
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true

However, when trying to access myu.com/grafana it says that the URL does not exist. Code 404.

Hi Cesar,
this is my VH config:

<VirtualHost *:443>
	ServerName grafana.domain.com

	Include /etc/apache2/sites-available/ssl_config.incl

	# We use docker bridge instead of 192.168.222.10, it might save a bit resources
	ProxyPass / http://172.17.0.1:3001/
	ProxyPassReverse / http://172.17.0.1:3001/
	RequestHeader unset Authorization
	ProxyRequests Off

	<proxy *>
		AuthName "dahoam"
		Include /etc/apache2/sites-available/ldap_config.incl
		Require ldap-group CN=openhab_users,.....
		RewriteEngine On
		RewriteRule .* - [E=PROXY_USER:%{LA-U:REMOTE_USER},NS]
		RequestHeader set X-WEBAUTH-USER "%{PROXY_USER}e"
	</proxy>

	ErrorLog ${APACHE_LOG_DIR}/grafana_error.log
	CustomLog ${APACHE_LOG_DIR}/grafana_access.log combined
</VirtualHost>

Grafana proxy auth config:
image

Marco

1 Like

This helped me! Thanks!