ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: nginx-ru@xxxxxxxxx
  • Subject: Re: Переменные в proxy_pass
  • From: Alexey Kovyrin <alexey@xxxxxxxxxxx>
  • Date: Wed, 22 Jul 2009 12:46:23 -0400
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=GcDJAa+xbGIBjbUZhWTd8t6hNcu7fwB2Zk0hpo7ppK0=; b=LgKwzYcqbsH5qh+xGbrOyCxarsBP4Xbqy8/vsJZO97TOhejavbcGvhCaYVW/nF53GG yRmv7FR7h43Wr6p98UmtUgjfTAtOxbbw6Dh1B5UNyb4n6j3E9bTTv7QAEd2++uXoJYvW 97YE4NFUTDZL3iG9GTIn2cWgD6BNlDyVXIr3A=
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=YoqdcRvsF7ol5IRDJSISS+udZYupEGz8l827ONp3knBEjWwGZn5HVr2Q8KMDus6ItB X4+F93+i7P68nDhQu/AgX0ZUpvTWBg2LOyR9pKWPDSVJiRwNCPpx60MK1qrvkOxGQBb1 t9Ooq4pj/EMnpn2TY8AipxTbRh1m5J3oSV+NM=
  • In-reply-to: <f0e045700907220913g1f30b58dg2d4d2079502731e3@xxxxxxxxxxxxxx>
  • References: <f0e045700907220913g1f30b58dg2d4d2079502731e3@xxxxxxxxxxxxxx>

Я бы попробовал записать все это в переменную и потом только
proxy_pass http://$my_var - насколько помню, у меня где-то такое было.

2009/7/22 J Channel <jchannelx@xxxxxxxxx>:
> Привет!
> Бекенды кладут в куку 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/";
>
> Можно ли реализовать такую функциональность штатными средствами, или надо
> писать патч?
>



-- 
Alexey Kovyrin
http://kovyrin.info/


 




Copyright © Lexa Software, 1996-2009.