Welcome! Log In Create A New Profile

Advanced

Re: rewrite last using variable

Francis Daly
October 28, 2013 05:58AM
On Mon, Oct 28, 2013 at 09:36:20AM +0100, Ingo Schmidt wrote:

Hi there,

I was (partly) wrong when I said

"""
> 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.

No; here what is sent to the client includes the bare ?.
"""

Reading the code, the string does go through some uri-escaping and some
uri-unescaping within nginx, and the end result is that a ? in $var
remains a ? in what is written to the client. But it's not a straight
copy of the string.

> >I believe it is intended to be "no", for internal rewrites at least.
> Hmm, any reason why it might be intended?

My guess? The value given must either be already uri-escaped, or not. And
nginx chooses "not".

> Also, it would be nice if the docs could mention this, because I find it
> unintuitive, if rewrite behaves differently depending on the rewrite type.

If you presume that the docs are in the directory called "src", then
it's mentioned there ;-) Anything "redirect"ed goes through an unescape.

I expect that a correct clarifying patch to the docs will be welcomed,
if you fancy writing one.

> >You can do something like set $var "/url"; set $vararg "par=val";
> >rewrite ^ $var?$vararg last;
> Well, in my case that is exactly what I am trying to avoid, because my
> variable is set in a map and I would have to create two maps then, one
> with the URLs, the other with arguments.

Generally in nginx, if there's something that you can't do in config,
you can do it in a module you write. Possibly you can do it in config
using one of the scripting language modules.

(Usually, config is simpler in the short term.)

Good luck with it,

f
--
Francis Daly francis@daoine.org

_______________________________________________
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: 241
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