Переменные в proxy_pass

J Channel jchannelx at gmail.com
Wed Jul 22 20:13:21 MSD 2009


Привет!
Бекенды кладут в куку JSESSIONID постоянную часть, каждый свою.
Например k3t2 - это сервер номер 3, томкат на порту 8020
Хочется заворачивать клиентов по этим данным.
Написана такая конфигурация
             if ( $cookie_JSESSIONID ~ k(\d)t(\d)$ ) {
                 set $i $1;
                 set $p $2;
                 proxy_pass  "http://10.0.0.${i}:80${p}0";
             }
Получаю 500 ошибку
Текст дебаглога:

2009/07/22 19:58:02 [notice] 22554#0: *265 "k(\d)t(\d)$" matches
"C8E1CD03759419B1D76EB8BCC576DCD9.k3t2", client: 10.1.1.180, server:
testhost.com, request: "GET /book/nginx-logo.png HTTP/1.1", host: "
testhost.com", referrer: "http://testhost.com/serv/"
2009/07/22 19:58:02 [debug] 22554#0: *265 http script if
2009/07/22 19:58:02 [debug] 22554#0: *265 http script complex value
2009/07/22 19:58:02 [debug] 22554#0: *265 http script capture: "3"
2009/07/22 19:58:02 [debug] 22554#0: *265 http script set $i
2009/07/22 19:58:02 [debug] 22554#0: *265 http script complex value
2009/07/22 19:58:02 [debug] 22554#0: *265 http script capture: "2"
2009/07/22 19:58:02 [debug] 22554#0: *265 http script set $p
2009/07/22 19:58:02 [debug] 22554#0: *265 post rewrite phase: 3
2009/07/22 19:58:02 [debug] 22554#0: *265 generic phase: 4
2009/07/22 19:58:02 [debug] 22554#0: *265 generic phase: 5
2009/07/22 19:58:02 [debug] 22554#0: *265 access phase: 6
2009/07/22 19:58:02 [debug] 22554#0: *265 access: B401010A FFFFFFFF 151F3AD4
2009/07/22 19:58:02 [debug] 22554#0: *265 access phase: 7
2009/07/22 19:58:02 [debug] 22554#0: *265 post access phase: 8
2009/07/22 19:58:02 [debug] 22554#0: *265 malloc: 0000000014F2C2D0:4096
2009/07/22 19:58:02 [debug] 22554#0: *265 http script copy: "http://10.0.0."
2009/07/22 19:58:02 [debug] 22554#0: *265 http script var: "3"
2009/07/22 19:58:02 [debug] 22554#0: *265 http script copy: ":80"
2009/07/22 19:58:02 [debug] 22554#0: *265 http script var: "2"
2009/07/22 19:58:02 [debug] 22554#0: *265 http script copy: "0"
2009/07/22 19:58:02 [debug] 22554#0: *265 http init upstream, client timer:
0
2009/07/22 19:58:02 [debug] 22554#0: *265 epoll add event: fd:9 op:3
ev:80000005
2009/07/22 19:58:02 [error] 22554#0: *265 zero length URI to proxy, client:
10.1.1.180, server: testhost.com, request: "GET /site/nginx-logo.png
HTTP/1.1", host: "testhost.com", referrer: "http://testhost.com/serv/"

Можно ли реализовать такую функциональность штатными средствами, или надо
писать патч?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20090722/bc8eafd2/attachment.html>


More information about the nginx-ru mailing list