Can't add influxdb datasource after reverse proxy is activated

i’m using apache as reverse proxy, while adding influx as datasource its giving error as "Not Found".
grafana conf

grafana add datasource

Hi,

Are you trying to proxy influxdb through apache or only Grafana? What port runs influxdb on? What error do you get when you create the datasource (check grafana server log).

Thanks

Marcus

i’m trying to proxy only grafana through apache. since grafana and influxdb is on same server i have added as localhost:8086 in data source Url.

Grafana server log : t=2018-02-20T15:48:16+0530 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=GET path=/api/noaccess.php status=404 remote_addr=192.168.0.76 time_ms=2 size=23 referer=http://192.168.0.66/dashboard/datasources/new?gettingstarted

Feels like you’ve configured apache incorrectly. Please show the apache configuration you’re using.

Marcus

<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /dashboard http://localhost:3000
ProxyPassReverse /dashboard http://localhost:3000

I have added these lines in my apache config file. i can access grafana and login with localhost/dashboard.

If you try to access http://<admin username>:<admin password>@localhost/dashboard/api/admin/settings does that give you a proper 200 response?

We have a apache proxy docker container for test purposes in grafana github repository. One difference that I can spot is that we’re using a trailing / (slash) in both grafana and apacge configuration. Please see https://github.com/grafana/grafana/blob/master/docker/blocks/apache_proxy/proxy.conf for apache config and then we’re using the following grafana config:

root_url = %(protocol)s://%(domain)s:/grafana/

We don’t have ProxyPreserveHost On, but maybe doesn’t matter?

Marcus

yes i’m getting the proper response.

i tried with commenting “ProxyPreserveHost On” and added trailing / (slash). still same error.

Thanks
Rakshith

I can see that you’re using the hostname of 192.168.0.66. You need to change the grafana domain config:

domain = 192.168.0.66

Refer to Running Grafana behind a reverse proxy documentation.

Marcus

Thanks for the reply Marcus.

Apache mod security was blocking the request. I fixed that.

Rakshith

1 Like