? -> %3f при передаче на бэкенд
    Igor Zakharov 
    garikz at gmail.com
       
    Wed Feb  6 19:45:01 MSK 2008
    
    
  
Всем привет, опять столкнулся с той же проблемой с экранированием. nginx
0.5.35
Имеем запрос /cgi-bin/script.pl?a=b
Если nginx не находит предварительно
сгенеренный /Data/static/$host/script.pl_a_b (ну, к примеру, для этого
виртхоста него нет), то он обращается к memcached.
И вот если и там такого ключа нет, то идет обращение на бэкенд. Тут и
начинается самое интересное.
На бэкенд передается запрос GET /cgi-bin/script.pl%3fa=b
Кусок конфига:
if ($request_uri = '/cgi-bin/script.pl?a=b') {
    rewrite ^(.*)$ /static/script.pl_a_b? last;
}
location = /static/script.pl_a_b {
    if ($request_method = POST) {
        rewrite ^(.*)$ $request_uri;
        proxy_pass http://backend;
    }
    if (!-e /Data/static/$host/script.pl_a_b) {
        rewrite ^(.*)$ /memcached_generic;
    }
    types { }
    default_type text/html;
    alias /Data/static/$host/script.pl_a_b;
    internal;
}
location = /memcached_generic {
    set $memcached_key "$host$request_uri";
    memcached_pass memcached;
    error_page 404 502 504 405 = @fallback;
}
location @fallback {
    rewrite ^(.*)$ $request_uri break;
    proxy_set_header Host $host;
    proxy_pass http://backend;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20080206/45dda877/attachment.html>
    
    
More information about the nginx-ru
mailing list