njs: get raw requestURI or full querystring
Dmitry Volyntsev
xeioex at nginx.com
Wed Apr 28 13:17:24 UTC 2021
On 28.04.2021 16:12, Gunter Grodotzki wrote:
> sadly the whole object is empty. no key / no value.
>
>
Try the following variable
http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_uri
decodeURIComponent(r.variables.request_uri.split('?')[1])
in njs CLI
>>
decodeURIComponent("https://url.rw/?https%3A%2F%2Flifeofguenter.de".split('?')[1])
'https://lifeofguenter.de'
>> On 28 Apr 2021, at 14:17, Sergey A. Osokin <osa at freebsd.org.ru> wrote:
>>
>> On Wed, Apr 28, 2021 at 07:45:37AM +0200, Gunter Grodotzki wrote:
>>> Unfortunately r.args is empty if no key/value pair is given.
>> Well, the r.args is empty in case of an emptyness of a querystring.
>>
>> But we have a bit different case when URL contains a query
>> string with a key, but without a value for that one,
>> i.e. "https://url.rw/?https%3A%2F%2Flifeofguenter.de".
>>
>> So, the "https%3A%2F%2Flifeofguenter.de" is the key and its value
>> is empty.
>>
>> --
>> Sergey Osokin
>> _______________________________________________
>> nginx-devel mailing list
>> nginx-devel at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
More information about the nginx-devel
mailing list