Welcome! Log In Create A New Profile

Advanced

Re: Getting rewritten and encoded/escaped url in nginx module

Maxim Dounin
June 03, 2014 01:18PM
Hello!

On Tue, Jun 03, 2014 at 09:42:41AM -0700, Jayadev C wrote:

>
>
> Hi,
>
>
> I am writing a nginx proxy module and want to grab the url which
> is urlencoded (as the client sends it) and also after rewrite
> rules are applied.  My typical url looks like :
> path1/path2/path3/urlencoded(key)?args, after rewriting the url
> I would love to have is something like :
>
> newpath1/newpath2/newpath3/../urlencoded(key)?args.
>
> Currently , r->uri  is decoded rewritten uri, r->unparsed_uri is
> encoded but not rewritten.
>
> I read on the forum that nginx decodes the url for rewrite, is
> there a handy internal function I can use encode the rewritten
> url back. A simple use of ngx_escape_uri(r->uri) with different
> parameters doesn't do what I want out of the box.

The ngx_escape_uri(r->uri) _is_ the internal function you should
use if you need encoded URI.

If in doubt, try looking, e.g., into the ngx_http_proxy_create_request()
function to see how it's done there.

--
Maxim Dounin
http://nginx.org/

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

Getting rewritten and encoded/escaped url in nginx module

Jayadev C June 03, 2014 12:44PM

Re: Getting rewritten and encoded/escaped url in nginx module

B.R. June 03, 2014 01:12PM

Re: Getting rewritten and encoded/escaped url in nginx module

Maxim Dounin June 03, 2014 01:18PM

Re: Getting rewritten and encoded/escaped url in nginx module

Jayadev C June 03, 2014 05:10PM

Re: Getting rewritten and encoded/escaped url in nginx module

Maxim Dounin June 04, 2014 11:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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