Welcome to WebmasterWorld Guest from 54.196.244.186

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

redirect first server to second server

     
3:30 pm on Nov 28, 2012 (gmt 0)

New User

joined:Nov 28, 2012
posts:4
votes: 0


Hi to all...

I have two server with apache web server.

in the first server name is www.domain.com .This server has DocumentRoot /var/www but there isn't any pages.

In the second server name server.domain.com. There is other apache web server, this server has DocumentRoot /var/www and in this path there is the real web of domain www.domain.com.

I ask you...

How to.... when any user will write in browser www.domain.com the first apache server redirect to second server, but url in browser can not change of www.domain.com to server.domain.com in all pages.

Best Regards.
3:51 pm on Nov 28, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


welcome to WebmasterWorld, tgarijo!

you probably want to use mod_proxy.
3:59 pm on Nov 28, 2012 (gmt 0)

New User

joined:Nov 28, 2012
posts:4
votes: 0


Thank You phranque

Can you post some example for my case? I have not experience with mod_proxy.

Regards
4:03 pm on Nov 28, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Are the two servers the same physical machine?

If yes, you need an internal rewrite.

If not, you need to proxy the requests. However this is not without problems. Both servers will have to work twice as hard for every request, and unless you take special steps to use the X-FORWARDED series of headers, the server where the content resides will not be able to log who is really requesting the pages because all requests will appear to have come only from the other server.

You do not want a "redirect". With a redirect, the first server tells the browser to make a new request for a different URL and the address bar in the browser is updated when that second request is made.

There's some prior discussion of proxy methods here:
[google.com...]
Please use example code from those earlier threads.
5:13 pm on Nov 28, 2012 (gmt 0)

New User

joined:Nov 28, 2012
posts:4
votes: 0


Ok Thank You

works fine with mod_proxy, it's possible that one rule, not use mod_proxy and all other yes

Example

www.domain.com (use mod_proxy)
www.domain.com/foo (not use mod proxy )
5:37 pm on Nov 28, 2012 (gmt 0)

New User

joined:Nov 28, 2012
posts:4
votes: 0


I respond to me

ProxyPreserveHost On
ProxyPass /foo !
ProxyPass / [domain1.com...]
ProxyPassReverse / domain1.com

regards
5:39 pm on Nov 28, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


You might want to set the other server to accept only requests from the proxy server.