homepage Welcome to WebmasterWorld Guest from 54.226.191.80
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
redirect first server to second server
tgarijo




msg:4523247
 3:30 pm on Nov 28, 2012 (gmt 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.

 

phranque




msg:4523256
 3:51 pm on Nov 28, 2012 (gmt 0)

welcome to WebmasterWorld, tgarijo!

you probably want to use mod_proxy.

tgarijo




msg:4523264
 3:59 pm on Nov 28, 2012 (gmt 0)

Thank You phranque

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

Regards

g1smd




msg:4523265
 4:03 pm on Nov 28, 2012 (gmt 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.

tgarijo




msg:4523286
 5:13 pm on Nov 28, 2012 (gmt 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 )

tgarijo




msg:4523291
 5:37 pm on Nov 28, 2012 (gmt 0)

I respond to me

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

regards

g1smd




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved