two small questions about embedded perl

Sven 'Darkman' Michels sven at darkman.de
Wed Dec 15 01:28:39 MSK 2010


Hi,

Am 14.12.2010 22:59, schrieb Igor Sysoev:
> Try
> 
> -      proxy_pass  http://backend;
> +      proxy_pass  http://backend/;

ok, now i get a loop...

*1 rewrite or internal redirection cycle while internal redirect to "/test.jpg",
client: ::ffff:x.x.x.x, server: test.domain.tld, request: "GET /old_key/test.jpg
HTTP/1.0", host: "test.domain.tld"

I guess the problem is that i have a "last resort" code which just does a
$r->internal_redirect($r->uri);
(this is done in case the request doesn't match all criterias and thus should be
passed as is to the proxy...)

some break, last, whatever missing? the config looks like:

    location ~ \.(png|jpg|gif)$  {
      perl testpackage::handler;
    }
    location / {

            proxy_pass             http://internal/;
            proxy_set_header       Host $host;
            proxy_cache            STATIC;
            proxy_cache_valid      200  1d;
            proxy_cache_use_stale  error timeout invalid_header updating
                                   http_500 http_502 http_503 http_504;
    }

so when location matches, query is checked by the module and afterwards passed
to the proxy. If no match, just proxy it...

Regards and many thanks!
Sven



More information about the nginx mailing list