Trouble with somewhat complex proxy config
Maxim Dounin
mdounin at mdounin.ru
Thu Dec 15 12:57:54 UTC 2011
Hello!
On Wed, Dec 14, 2011 at 05:42:35PM -0800, Daniel Jabbour wrote:
> Hi,
>
> So basically here is what I'm trying to accomplish:
>
> 1. I have several different rails apps running inside passenger
> standalone instances. I'd use the module, but I need to have
> separate ruby versions / parameters for each, so they're happily
> on standalone instances.
>
> 2. The standalone instances run fine and I can connect to them.
>
> 3. Based on the presence of an argument "needle" in the GET
> params, I want to proxy pass to different locations. If the
> $needle is present, I want to proxy to $needle.somehost.com.
> Otherwise I want to proxy to localhost:3000. I know this sounds
> a little crazy, and I'd rather not get into "why," suffice it to
> say it's a pretty unique setup.
>
> Here is my config, though it isn't quite working out. I get
> internal errors from nginx after a long timeout.
>
> server {
> listen host.ip.address:443 ssl;
> server_name host.server.com;
> root /var/www;
>
> ssl_certificate /my.crt;
> ssl_certificate_key /my.key;
>
> error_page 500 502 503 504 /50x.html;
> location = /50x.html {
> root html;
> }
>
> 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;
> }
> }
>
> Any assistance would be greatly appreciated.
What's in error log?
Maxim Dounin
More information about the nginx
mailing list