Dynamic Proxy Passing

Hello,

I have a situation where a server needs to proxy to a variable backend
depending on the URI.

I use x-accel-redirect to a URI like /files/serverX/fileY;

I then need my server to proxy_pass to serverX.domain.com/fileY; and
return this data to the user.

There will be multiple servers with this so something where I need to
update the configuration when I add a new serverX would be somewhat
undesirable.

Question is, what’s the best way to go about this?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,67784,67784#msg-67784

This is just conceptual but you could try (if the ‘serverX’ is like a
prefix
for a subdomain):

location ~ /files/(.)/(.) {
proxy_pass http://$1.domain.com/$2;
}

This way you just need also to define a resolver (
http://wiki.nginx.org/NginxHttpCoreModule#resolver ) if your hosts are
not
defined in upstream{} block or IPs.

rr


From: “Ensiferous” [email protected]
Sent: Thursday, March 25, 2010 8:12 PM
To: [email protected]
Subject: Dynamic Proxy Passing

Yes. this was the conclusion I came to as well after talking it over in
the IRC channel. Using IPs is probably the ideal here.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,67784,68364#msg-68364

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs