I'm using openresty to rewrite the query params in a URI. The way I
do it is of course to extra the query params, rewrite them and then
use ngx.req.set_uri_args() to set the query params. What I notice is
that it unescapes the URI also.
For the website I was having issues with, the URL is of the form
https://host/uri?query=x
Here uri is actually json that is run through a url encoder to escape
it. When I try to rewrite the query=x part using
ngx.req.set_uri_args(), I'm running into an issue where uri is now
transformed back into its original json and breaks the request.
I have worked around it by copying $request_uri to $orig_uri and
encoding the proxy_pass as something like proxy_pass
https://host$orig_uri$rewrite_args (i set $rewrite_args instead of
using ngx.req.set_uri_args). However, was wondering if there is
something I am missing here that would avoid the need for this
workaround.
--
regards,
Arun