Forum: Ruby on Rails redirect_to for Nginx Reverse Proxy?

37bf861101bbbb89b6c0830968d0d3c4?d=identicon&s=25 The Chromag (chromag)
on 2012-11-02 14:46
I'm trying to figure out the best way to do this.  I'm working on a web
application where the entire thing requires the user to be logged in.  I
use a before_filter in all the controllers to check for the logged in
session variable.  If it doesn't exist, I redirect to the "login"
controller and the "index" action.

We're planning on rolling out this web app to multiple clients soon so
I'm planning on putting multiple servers behind an Nginx reverse proxy.
So, for example, when the user goes to:

https://www.thenameofthesite.com/site1

It accesses a server that serves site1 (i.e. internaladdress1.com/
without the site1).  Another server will serve site2.

Problem is - if the user isn't logged in it makes the call to:

redirect_to :controller => "login", :action => "index"

This works fine in a single server configuration - but in this case it
redirects the browser to:

https://www.thenameofthesite.com/login/index

What's the best way to handle this kind of situation?  Will there be any
issues with session variables in this type of reverse proxy situation?

Thanks.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.