Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What I want to do seems like it should be fairly simple. I would like to have one external address, and redirect to multiple different internal servers based on the login that the user uses.

That is, given users u1, u2, u3 and u4, I want them all to login to www.domain.com, and have users u1 and u2 internally redirected to internal1.domain.com and u3 and u4 redirected to internal4.domain.com.

The logged in user should also be passed through so that the internal site knows which user is logged in. The internal sites will not be externally addressable.

I have looked at Perlbal, and that seems to allow some of what I want, but I can't see any option to redirect based on the logged in user. Mod_proxy also does not seem to allow this level of control.

What other options exist, or how can I make the aforementioned options do what I want?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Apache's mod_proxy could, in fact, do exactly what you want.

Its session-stickiness reads from cookie values; if all of the application servers know which server a user needs to go to (I'm not really clear on how the user distribution is decided, but we'll assume that it's stored or calculable), then it's simple.

Any server could give the user their server cookie on the first request. Say apache throws them to internal1, but they should be on internal2; the cookie can be something like SERVERID set to server.internal2. On the second request, with the below config, apache will see the cookie and send the user to the BalancerMember backend that is attached to the route defined in the cookie.

<Proxy balancer://domain>
    BalancerMember http://internal1.domain.com route=internal1
    BalancerMember http://internal2.domain.com route=internal2
</Proxy>

ProxyPass / balancer://domain/ stickysession=SERVERID
ProxyPassReverse / balancer://domain/
share|improve this answer
    
That is nice. This cookie could also be set on the redirector after they login, so they wouldn't even need to go to the wrong box first. –  Paul Wagland Mar 21 '11 at 22:19
add comment

Well I hope you have some programming knowledge...

The easiest way is to use a basic web server and make a login script using php/mysql.

When a user logs in you can use the header(Locaction: internalx.domain.com); to send the user to a different page.

To keep user data you can simply use cookies or (more advanced) cookies or one time links to the internal.domain.com server and use the same database for the sites.

You can google for login scripts or ask on stackoverflow.com for more info. But I assume since you allready have the internal sites that either you or someone you know has programming experience.

share|improve this answer
    
I was hoping to find something off of the shelf that I just didn't know about… Coding is the fallback option, but certainly an option. –  Paul Wagland Mar 21 '11 at 22:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.