Welcome! Log In Create A New Profile

Advanced

rewrite last using variable

Ingo Schmidt
October 27, 2013 08:58PM
Hi,

consider the following simplified nginx config snippet:

set $var "/url?par=val";
location = /a {
rewrite ^ $var redirect;
}
location = /b {
rewrite ^ $var last;
}
location = /url {
proxy_pass http://some_backend;
}

For location a the redirect goes via the client and everything works
just fine.
For location b the redirect is internal and now the backend cannot
process the request anymore.

I found out that it in the 2nd case the backend sees a URL encoded form
of the contents of $var. So the question mark has become %3F and
naturally the backend can't find the request parameters.
I guess that the URL encoding also takes place in the first case, but
here the client decodes the URL and thus everything is ok again.

So here is my question:
Is it possible in nginx to make rewrites with variables where the
variable contains a URL with parameters like in the example? If yes,
what do I need to change? If no, what other options do I have?

Cheers, Ingo =;->

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

rewrite last using variable

Ingo Schmidt October 27, 2013 08:58PM

Re: rewrite last using variable

Francis Daly October 28, 2013 04:10AM

Re: rewrite last using variable

Ingo Schmidt October 28, 2013 04:38AM

Re: rewrite last using variable

Francis Daly October 28, 2013 05:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 304
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