Team: Need your help for Grafana Auth proxy work with Nginx. I have been struggling with this issue and have no solution yet. I tried couple of solutions provided in this forum and else where, none seems working for me.
I end up with the following error message:
invalid API key" logger=context error=“invalid API key”
Tech Details:
Grafana.ini
[auth.proxy]
enabled = true
header_name = X-WEBAUTH-USER
header_property = username
auto_sign_up = false
nginx config:
I made the following file and copied to
My Dockerfile:
ARG PORT=80
RUN apk update
RUN apk add nginx
COPY /domain /etc/nginx/sites-available/domain
EXPOSE $PORT
CMD [“nginx”, “-g”, “daemon off;”]
My domain file:
server {
listen 80;
root /usr/share/nginx/html;
index index.html index.htm;
location /grafana/ {
auth_basic “grafana”;
auth_basic_user_file “/etc/nginx/.htpasswd”;
proxy_pass https://domain;
proxy_set_header X-WEBAUTH-USER $remote_user;
proxy_set_header Authorization “”;
}
Proxy Grafana Live WebSocket connections.
location /api/live/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_pass https://domain;
}
}
Am I missing something? How do I figure out whether or not nginx server is being hit? Is there a way to add some echo in location /grafana/ {} for debugging purpose? I do not have an access to the server to view nginx logs. I can view Grafana container logs though.
My Grafana and Nginx running on the same container.
Please help! Stuck up, it’s a blocker.
Please let me know if more details are required. Thanks!