Subpath grafana " Failed to load resoruce file " Error

I tried to use grafana on subpath with nginx by refering these links;

http://docs.grafana.org/installation/behind_proxy/#nginx-configuration-with-sub-path
https://serverfault.com/questions/684709/how-to-proxy-grafana-with-nginx
https://community.grafana.com/t/grafana-not-running-behind-nginx/711/2

I am getting “{{alert.title}}” and “Failed to load resource: the server responded with a status of 401 ()” Errors when use the url ;
" https://company.com/grafana/login "
Browser Elements and Console inspect are on attach.

My environment ;
Docker grafana container port 5602 and nginx use the port and forward to 9001.

Nginx conf ;

location ~ (/grafana/.) {
proxy_pass http://127.0.0.1:9001;
proxy_max_temp_file_size 0;
proxy_set_header Host $host;
rewrite ^/grafana/(.
) /$1 break;
proxy_ignore_client_abort on;
}

Grafana config;
/etc/grafana/grafana.ini

[server]
protocol = http
domain = company
root_url = %(protocol)s://%(domain)s:/grafana


your proxy_pass setting is not correct.

http://docs.grafana.org/installation/behind_proxy/#nginx-configuration

try proxy_pass http://127.0.0.1:9001/;

Thank you @torkel, I changed configurations as you said but I am still getting “{{alert.title}}” and “Failed to load resource" error

location /grafana/ {
proxy_pass http://127.0.0.1:9001/;
}

[server]
protocol = http
domain = company
root_url = %(protocol)s://%(domain)s:/grafana

Hi @torkel ,

Iam also facing the same issue. I am running grafana as one container and nginx as another container. They are running in the same docker network.

My configs are as below:

grafana.ini

root_url: http://containername:3000/grafana/

Nginx config:

location /grafana/ {
proxy_pass http://containername:3000/;
}

Could you please let me know if iam missing out anything or any of my configs are wrong?

Regards,
Amrutha

1 Like