two small questions about embedded perl
Igor Sysoev
igor at sysoev.ru
Wed Dec 15 01:38:50 MSK 2010
On Tue, Dec 14, 2010 at 11:28:39PM +0100, Sven 'Darkman' Michels wrote:
> 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...)
You should "return DECLINED;", in this case nginx will continue to
process usual handler chain: index, static files, etc.
> 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...
location ~ \.(png|jpg|gif)$ {
perl testpackage::handler;
# do $r->internal_redirect("/new/...");
}
location /new/ {
proxy_pass http://internal/;
}
location / {
proxy_pass http://internal/;
}
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list