Trouble with somewhat complex proxy config

Alexandr Gomoliako zzz at zzz.org.ua
Thu Dec 15 02:20:09 UTC 2011


On Thu, Dec 15, 2011 at 3:42 AM, Daniel Jabbour <drj at inigral.com> wrote:
> Here is my config, though it isn't quite working out. I get internal errors from nginx after a long timeout.

Check your error.log, I'm sure there is an explanation.

>  location / {
>    resolver dns.ip.address;
>    if ($args ~* needle=([a-z0-9\-]+)\&? ) {
>      set          $needle         $1;
>      proxy_pass   https://$needle.somehost.com;
>      break;
>    }
>    proxy_pass http://127.0.0.1:3000;
>    proxy_set_header Host $host;
>  }
> }

Try this with map instead:
...

map $arg_needle $needle_host {
    default   '127.0.0.1:3000';
    ~^  $arg_needle.somehost.com;
}

server {
    location / {
        proxy_pass http://$needle_host;
    }
}



More information about the nginx mailing list