Add parameter to url
December 09, 2021 04:03AM
Hi, I know this should be a very simple problem to solve but I'm not able in any way. I'm spending several days trying every solution I can find on many forum but nothing.
What I need is just to add a parameter at the end of an URL. Actually I'm using Grafana behind Ngnix and what I need is as following:
I can have two situation:
1) The required URL is https://www.mydomain.com/mygraf/login
If so, I need to redirect/rewrite the URL as https://www.mydomain.com/mygraf/d/uiehy96ta/mydash?orgId=1&kiosk
2) The required URL is https://www.mydomain.com/mygraf/whatever (i.e. https://www.mydomain,com/mygraf/d/uiehy96ta/mydash?orgId=1)
If so, I need just to add &kiosk in order to rewrite the URL as https://www.mydomain.com/mygraf/d/uiehy96ta/mydash?orgId=1&kiosk
(if &kiosk is already within the URL, of course it's ok and I have nothing to add/change)


If I try copy paste directly on the browser it works as espected, and I just would like replicate it via Nginix configuration.
Here is mine:
server {
listen 80;
server_name mydomain.com www.mydomain.com;
return 301 https://mydomain.com$request_uri;
}
server {
listen 443 ssl http2;
server_name mydomain.com www.mydomain.com;
index index.html index.htm index.php;
ssl_certificate /etc/nginx/ssl/mydomain.com/fullchain.cer;
ssl_certificate_key /etc/mydomain.com/ssl/mydomain.com/mydomain.com.key;
ssl_session_timeout 30m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
ssl_session_cache shared:SSL:10m;
ssl_prefer_server_ciphers on;
ssl_buffer_size 8k;
ssl_stapling on;
resolver 8.8.8.8;
ssl_stapling_verify on;
add_header Strict-Transport-Security max-age=31536000;
location / {
root /var/www/mydomain.com/public_html;
access_log /var/log/nginx/mydomaincom.access.log;
error_log /var/log/nginx/mydomaincom.error.log;
}
# ---------------- Grafana
location /mygraf/ {
#rewrite ^(.)$ $1?kiosk last;
#rewrite ^(.)uiehy96ta(.*)$ $1/uiehy96ta/$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;
}
}

Thanks a lot to all
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 145
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready