Welcome! Log In Create A New Profile

Advanced

Re: two small questions about embedded perl

December 14, 2010 05:44PM
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/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

two small questions about embedded perl

Sven 'Darkman' Michels December 14, 2010 04:40PM

Re: two small questions about embedded perl

Igor Sysoev December 14, 2010 05:04PM

Re: two small questions about embedded perl

Sven 'Darkman' Michels December 14, 2010 05:32PM

Re: two small questions about embedded perl

Igor Sysoev December 14, 2010 05:44PM

Re: two small questions about embedded perl

Sven 'Darkman' Michels December 15, 2010 12:48AM

Re: two small questions about embedded perl

Sven 'Darkman' Michels December 16, 2010 04:04PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 195
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready