Answer the question
In order to leave comments, you need to log in
How to replace url in nginx without changing the request itself?
Hello, I have kvm Raritan, which is able to give direct control of the host via URL (Direct Access via url).
like this https://ip_raritan/dpa.asp?portname=XXX&username=&... .
This link opens a separate window with direct access to the desired host.
And there is a task in which you need to use a link like ip_address/raritan/portname=XXX to redirect the request to raritan by substituting only the port name (portname)
I do it through Nginx, so
location /raritan {
rewrite ^(/*/.*)/portname=(.*) https://<ip_raritan>/dpa.asp?portname=$2&username=user&password=password last;
}
Answer the question
In order to leave comments, you need to log in
rewrite ^(/*/.*)/portname=(.*) https://<ip_raritan>/dpa.asp?portname=$2&username=user&password=password last;
https://<ip_raritan>
. Then the redirect will be internal and there will be no 302 redirect and the URL will not change in the browser.rewrite ^(/.*)/portname=(.*) /dpa.asp?portname=$2&username=user&password=password last;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question