<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">The problem is ngx_http_proxy doesn't do that either, once rewrite is applied the url remains decoded (or I am not reading the code correctly). In fact escaping uri back is a bit tricky since you have to split the rewritten url to segments and apply encoding again (which would require looking at the original url to know the correct number of '/'s).<br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color:
rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">Anybody had attempted doing something like this ? or is there an easier way.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">Jayadev<br><span></span></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Tuesday, June 3, 2014 10:17 AM, Maxim Dounin <mdounin@mdounin.ru> wrote:<br> </font> </div> <br><br> <div class="y_msg_container">Hello!<br clear="none"><br clear="none">On Tue, Jun 03, 2014 at 09:42:41AM -0700, Jayadev C wrote:<br clear="none"><br clear="none">> <br clear="none">> <br clear="none">> Hi, <br clear="none">> <br clear="none">> <br clear="none">> I am writing a nginx proxy module and want to grab the url which <br clear="none">> is urlencoded (as the client sends it) and also after rewrite <br clear="none">> rules are applied. My typical url looks like : <br clear="none">> path1/path2/path3/urlencoded(key)?args, after rewriting the url <br clear="none">> I would love to have is something like :<br clear="none">> <br clear="none">> newpath1/newpath2/newpath3/../urlencoded(key)?args.<br
clear="none">> <br clear="none">> Currently , r->uri is decoded rewritten uri, r->unparsed_uri is <br clear="none">> encoded but not rewritten.<br clear="none">> <br clear="none">> I read on the forum that nginx decodes the url for rewrite, is <br clear="none">> there a handy internal function I can use encode the rewritten <br clear="none">> url back. A simple use of ngx_escape_uri(r->uri) with different <br clear="none">> parameters doesn't do what I want out of the box. <br clear="none"><br clear="none">The ngx_escape_uri(r->uri) _is_ the internal function you should <br clear="none">use if you need encoded URI.<br clear="none"><br clear="none">If in doubt, try looking, e.g., into the ngx_http_proxy_create_request() <br clear="none">function to see how it's done there.<br clear="none"><br clear="none">-- <br clear="none">Maxim Dounin<br clear="none"><a shape="rect" href="http://nginx.org/"
target="_blank">http://nginx.org/</a><div class="yqt3705042982" id="yqtfd01005"><br clear="none"><br clear="none">_______________________________________________<br clear="none">nginx mailing list<br clear="none"><a shape="rect" ymailto="mailto:nginx@nginx.org" href="mailto:nginx@nginx.org">nginx@nginx.org</a><br clear="none"><a shape="rect" href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></div><br><br></div> </div> </div> </div> </div></body></html>