rewrite + proxy

Denis F. Latypoff latypoff at yandex.ru
Fri Aug 29 13:09:45 MSD 2008


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

Как?

-- 
Best regards,
 Denis                          mailto:latypoff at yandex.ru






More information about the nginx-ru mailing list