Welcome! Log In Create A New Profile

Advanced

NJS module string to lowercase

Alexander Moskalenko
August 27, 2016 02:06PM
Приветствую!

Есть локейшн задача которого делать редирект с приведением uri к нижнему
регистру.
В данный момент используется LUA, который хотелось бы заменить на "родной"
модуль.

LUA блок выглядит так:
location ~ [A-Z] {
rewrite_by_lua_block {
return ngx.redirect((string.lower(ngx.var.uri)),301);
}
}

NJS блок:
js_run "function f(req, res) {
res.status = 301;
res.headers.location = req.uri.toLowerCase();
res.sendHeader();
res.finish();
}";

упорно получаю js exception: TypeError

Вопрос: что я делаю не так?
typeof(req.uri) возвращает string
т.к. документации толком нет пытаюсь использовать "родные" методы JS
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

NJS module string to lowercase

Alexander Moskalenko August 27, 2016 02:06PM

Re: NJS module string to lowercase

Igor Sysoev August 28, 2016 03:18AM

Re: NJS module string to lowercase

Alexander Moskalenko August 28, 2016 04:28AM

Re: NJS module string to lowercase

Roman Arutyunyan August 28, 2016 04:40AM

Re: NJS module string to lowercase

Alexander Moskalenko August 28, 2016 04:50AM

Re: NJS module string to lowercase

Igor Sysoev August 28, 2016 05:22AM

Re: NJS module string to lowercase

Alexander Moskalenko August 28, 2016 05:46AM

Re: NJS module string to lowercase

Alexander Moskalenko August 28, 2016 01:32PM

Re: NJS module string to lowercase

Roman Arutyunyan August 28, 2016 01:38PM

Re: NJS module string to lowercase

Alexander Moskalenko August 28, 2016 03:22PM

Re: NJS module string to lowercase

Vadim A. Misbakh-Soloviov August 28, 2016 03:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 149
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready