Rerouting to kiosk mode via nginx

Hi, as by the title, it’s a while that I’m trying to use nginx to reroute the url adding “&refresh=2s&kiosk”.
Pratically, I just need to append “&refresh=2s&kiosk” at the end of the url.
But I’m not able to do it in any way, I think I have done hundreds of different tests, but nothing.
Thanks so much

Hi @donatod,

Thanks for opening this post.

Can you please provide the steps of reproduction so that the community can also try to reproduce it on a test machine?

Thanks.

Ok. I use grafana behind ngnix, with no problem. Everithing works well.
Now I just would like that when I reach grafana, nginx add “&refresh=2s&kiosk” at the end of the url so that I can automatically login as kiosk mode.

If I try directly typing the url with “&refresh=2s&kiosk” at the end, it works great. Even if I’m not login, after do it I’m redirect to the dashboard in kiosk mode as I want.
But I’m not able to do the same via nginix, it always redirect me to the normal URL, no kiosk mode

  • grafana.ini
http_port = 2901
domain = [mydomain.com](http://mydomain.com/)
root_url = %(protocol)s://%(domain)s:%(http_port)s/mygraf/
serve_from_sub_path = true
  • nginx
location /mygraf/ {
#rewrite ^(.<em>)$ $1?kiosk last;
#rewrite ^(.</em>)v61IJiO7z(.*)$ $1/v61IJiO7z/$2?kiosk last;
proxy_pass http://localhost:50001/;
proxy_read_timeout 90;
proxy_ssl_session_reuse on;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
access_log /var/log/nginx/grf_res.access.log;
error_log /var/log/nginx/grf_res.error.log;

I made the change you suggest, but nothing. It still doesn’t work :frowning:

It will be interesting to see the nginx logs along with Grafana logs. That way there is more better chance to know what might be the issue.

Hi @usman.ahmad I’m not able to deal with the logs. I installed grafana with docker and I cannot find its log. Where do I have to search for it?
The nginix ones are empty,

Hi @donatod

Try to run the command docker logs

OR

to be getting more specific 1st run;

docker ps and get the name of the Nginx-container and then run

docker logs nginx-container-name

If still not, then try to go inside your Nginx container and see if you have logs there (this is only if you had defined configuration that ways as by default docker logs everything directly)