rewrite + proxy

Igor Sysoev is at rambler-co.ru
Fri Aug 29 14:28:10 MSD 2008


On Fri, Aug 29, 2008 at 04:09:45PM +0700, Denis F. Latypoff wrote:

> Hello Igor,
> 
>     Никогда не думал, что столкнусь с такой проблемой:
> 
>         upstream mod_perl {
>             server   192.168.12.10:8100;
>         }
> 
>         location   /article/ {
>             rewrite    ^/article/(.*)
>                         /article.html?name=$1
>                         break;
>             proxy_pass http://mod_perl;
>         }
> 
> посылаем запрос:
> 
> GET /article/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4 HTTP/1.1
> 
> в логах nginx:
> 
> 2008/08/28 14:58:19 [debug] 25550#0: *99 http request line: "GET /article/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4 HTTP/1.1"
> 2008/08/28 14:58:19 [debug] 25550#0: *99 http uri: "/article/Юникод"
> 2008/08/28 14:58:19 [debug] 25550#0: *99 http args: ""
> 2008/08/28 14:58:19 [debug] 25550#0: *99 http exten: ""
> 2008/08/28 14:58:19 [debug] 25550#0: *99 http process request header line
> ...
> 2008/08/28 14:58:19 [debug] 25550#0: *99 http proxy header:
> "GET /article.html?name=Юникод HTTP/1.0
> ...
> 
> в mod_perl распечатываем запрос:
> 
> sub handler
> {
>     my $r = shift;
> 
>     require Apache2::RequestRec;
>     print STDERR $r->the_request, "\n";
> }
> 
> получаем:
> 
> GET /article.html?name=Юникод HTTP/1.0
> 
> Хотелось бы получить
> 
> GET /article.html?name=%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4 HTTP/1.0
> 
> Как?

Прилапгаемый патч должен помочь, но не факт, что не сломает что-то другое.
Как же я устал от этого rewrite и escaping. Надо это всё переписывать.


-- 
Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
Index: src/http/ngx_http_script.c
===================================================================
--- src/http/ngx_http_script.c	(revision 1538)
+++ src/http/ngx_http_script.c	(working copy)
@@ -574,6 +574,7 @@
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
                    "http script args");
 
+    e->is_args = 1;
     e->args = e->pos;
     e->ip += sizeof(uintptr_t);
 }


More information about the nginx-ru mailing list