Does Nginx honor DNS TTLs for proxy upstreams?

Maxim Dounin mdounin at
Wed Sep 28 16:13:55 UTC 2011


On Wed, Sep 28, 2011 at 12:05:07PM -0400, csg wrote:

> Maxim Dounin Wrote:
> -------------------------------------------------------
> > Errors suggest you don't have $backend set, and
> > resulting 
> > proxy_pass tries to go to "http://" which is
> > invalid.
> Yup, I am just curious how to accomplish that if you want to perform
> some rewriting before, for example to strip off some leading parts of
> the URL path. I came up with following test case:


>         location                        / {
>             rewrite                     ^/foo/(.*)$  /$1  break;

The "break" here will stop execution of rewrite module directives 
(including "set" below) on match.

>             resolver          ;
>             set                         $backend  "localhost:90";

This "set" won't be executed due to break above...

>             proxy_pass                  http://$backend;

... and $backend won't be set as a result.  Moving "set" before 
"rewrite .. break" will do the trick.

Maxim Dounin

More information about the nginx mailing list