<div dir="ltr"><div>Hi.<br><br>To perform rewrite, nginx does ngx_unescape_uri and then ngx_escape_uri to pass request to backend. There is a problem with this functions: they both can't handler "+" propertly: ngx_escape_uri does not escape «+» character<br>
<br>So when there is «%2b» sequence in rewrite command, it will be passed to backend as «+» where it SHOULD be interpreted as space character.<br></div><div>I've attached a small patch that solved a problem for me.<br>
<br></div><div>For testing I used<br></div><div>location /foo {<br></div><div> rewrite (.*) $1 break;<br></div><div> proxy_pass <a href="http://localhost:1234">http://localhost:1234</a>;<br>}<br></div><div>+ while true; do nc -l -p 1234; done — to watch what is really send to backend by nginx.<br>
</div><br><div><div>-- <br>Regards,<br>Dmitry<br>
</div></div></div>