How to pass a request from one apache server to another
You're going to want to do something like this on Server A:
NameVirtualHost *
<VirtualHost *>
ServerName owncloud.mydomain.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://192.168.0.10:80/
ProxyPassReverse / http://192.168.0.10:80/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
Depending on your application you may need to make use of one or all of the following:
- X-Forwarded-For - The IP address of the client.
- X-Forwarded-Host - The original host requested by the client in the Host HTTP request header.
- X-Forwarded-Server - The hostname of the proxy server.
Take a look at the mod_proxy documentation for more tips and tricks.
References
Related videos on Youtube
maxtorzito
Updated on September 18, 2022Comments
-
maxtorzito almost 2 years
I have two Apache Servers with mod_proxy enabled. I want to know how to "pass the request" from "Apache Server A" to "Apache Server B" using the same port (80).
In "server A" with internal ip: 192.168.0.5 I have configured DNS and I am also using it as my mail server.
In "server B" with internal ip: 192.168.0.10 I have my own cloud server.
Today when I access wwww.mydomain.com or www.mydomain.com/webmail everything works because the content is all in "server A", what I need is when somebody tries to access owncloud.mydomain.com they can access my server B without redirecting them to another port like owncloud.mydomain.com:81, I just want to use port 80.
Actually I get a redirect loop because when I try to redirect I guess "SERVER A" is getting the same request by himself. I have set my virtualhost working in the same "SERVER A" what I want is to "redirect" to another server using the same port and URL (owncloud.mydomain.com).
I don't want to redirect using another port.
-
Jekis almost 9 yearsExample from Atlassian confluence.atlassian.com/doc/…
-
-
maxtorzito about 11 yearsIt works. But i have another trouble, the owncloud server is in owncloud.mydomain.com/owncloud, how can i "redirect" to that path /owncloud. Now i have this in my server A: RewriteCond %{HTTP_HOST} ^owncloud\.mydomain\.com$ [NC] RewriteRule ^/(.*)$ owncloud.mydomain.com/$1 [P] How can i redirect to /owncloud THanks
-
slm about 11 yearsI'd ask it as another question.
-
maxtorzito about 11 yearsHere you have the question: serverfault.com/questions/511191/…