XHR Error (404 Not Found) Plug in error

I am running grafana in aws ec2 instance with load balancer and configured nginx proxy with ws02 identity server.
Without nginx proxy configuration, able to see dash board in grafana.
We have given root url as our proxy server url in grafana.ini file to load grafana dashboard. Unfortunately we are getting below error. Can you help us how to resolve this?

Plugin Error
(SystemJS) XHR error (404 Not Found) loading http://XXXX.com/grafana/public/app/grafana/features/panel/panel_ctrl.js?bust=1511862465684 Error: XHR error (404 Not Found) loading http://XXXXXX.com/grafana/public/app/grafana/features/panel/panel_ctrl.js?bust=1511862465684 Error loading http://xxxxxx.com/grafana/public/app/grafana/features/panel/panel_ctrl.js as “…/…/…/features/panel/panel_ctrl” from http://xxxxxx.com/grafana/public/app/grafana/plugins/panel/pluginlist/

Regards,
Madhu

Hi,

It feels like a configuration problem. Have you configured it according to documentation?

Marcus

Hi Marcus,

Yes i followed the same steps provided in this grafana documentation, still i am getting this error.
here is the nginx configuration where DASHBOARD_URL refers to DNS name. Do you see any problem here?

location /grafana/ {
proxy_pass {{ getenv “DASHBOARD_URL” }}/;
proxy_set_header X-ProxyScheme “https”;
proxy_set_header X-ProxyHost $http_host;
proxy_set_header X-ProxyPort 443;
proxy_set_header X-ProxyContextPath “”;
sub_filter_types *;
sub_filter /login/ /grafana/login/;
sub_filter /datasources/ /grafana/datasources/;
sub_filter /alerting/list/ /grafana/alerting/list/;
sub_filter /plugins/ /grafana/plugins/;
sub_filter /admin/ /grafana/admin/;
sub_filter /profile/ /grafana/profile/;
sub_filter_once off;
}

So are you trying to access grafana on http://XXXX.com or http://XXXX.com/grafana. When you get the above errors, which url are you browsing then?

The sub_filter parts feels like you’re trying to rewrite http://XXXX.com/login/ to http://XXXX.com/grafana/login which seems a bit weird to me.

Marcus

I configured root url as http://XXXX.com/grafana in grafana.ini configuration. We are getting above error while accessing on http://XXXX.com/grafana.
what should be the sub_filter part? We have some other other applications configured in nginx where subfilters are mentioned like this.

According to the documentation I referenced you only need the proxy pass information for starters.

What value does the environment variable DASHBOARD_URL have?

I would suggest that you try and remove everything besides the proxy_pass. If that works, then you can start adding other configurations.

Please let me know if this works

Marcus

DASHBOARD_URL is having AWS Rounte53 DNS name “https://xxx-app-test.xxxcloud.com”.
we will try removing all sub_filters and verify it. Let you know the results.

Madhu

No luck, still we are facing same issue.

Hi,

I just noticed that the url http://xxxxxx.com/grafana/public/app/grafana/features/panel/panel_ctrl.js is a bit weird. Normally a release of Grafana should have all it’s javascript files packed into a few files, i.e. if you view source of the page where you get your XHR errors, what script tags do you have. In the latest Grafana release I can see the following:

<script type="text/javascript" src="public/build/manifest.5d05166593a32d4b349d.js"></script>
<script type="text/javascript" src="public/build/vendor.2bcd8ce49106296505dc.js"></script>
<script type="text/javascript" src="public/build/app.95dde0ff4ce19a7a45dd.js"></script>

What version of Grafana are you using and how are you running Grafana, i.e. docker container, from source etc?

If you test to browse the url: http://xxxxxx.com/grafana/public/app/features/panel/panel_ctrl.js, do you get any valid response then?

Marcus