I'm running a web application through nginx and I need to remove part of the URL (?debug), whenever it may come up, for example:
From https://example.com/web?debug#menu=accounts
https://example.com/web?debug#menu=orders
To https://example.com/web#menu=accounts
https://example.com/web#menu=orders
My nginx configuration file had the following location block:
location / {
proxy_pass http://example.com;
}
I've looked online on ways to accomplish this, but nothing works. I've tried the following, but the url is passed as is, no changes:
location ^~ \?debug# {
if ($request_uri ~* "\?debug#(.*)") {
rewrite ^\?debug(.*)$ $1 break;
proxy_pass http://example.com/$1;
}
}
location / {
proxy_pass http://example.com;
}
Any help would be greatly appreciated.