Author |
|
cedricdaking
Joined: 22 Apr 2014 Posts: 11 Location: PARIS
|
Posted: Tue 22 Apr '14 12:04 Post subject: Reverse proxy with several websites ? |
|
|
Hello,
I m trying to setup a reverse proxy with several site that will redirect the request into several internal server.
I wanted to do that with several VirtualHost (like shown below).
Unfortunatly whatever I type on my browser testsupport.xxxx.com or support2.xxxx.com I m redirected at the first of the config file (in the exemple http://10.253.12.41/.
What am I doing wrong ?
Is it the ServerName key that will redirect to the right proxypass ?
Regards and thank you for your help.
<VirtualHost *>
ServerName testsupport.xxxx.com
ProxyRequests Off
ProxyPass / http://10.253.12.41/
ProxyPassReverse / http://10.253.12.41/
</VirtualHost>
<VirtualHost *>
ServerName support2.xxxx.com
ProxyRequests Off
ProxyPass / http://10.253.11.31/
ProxyPassReverse / http://10.253.11.31/
</VirtualHost> |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Tue 22 Apr '14 12:34 Post subject: |
|
|
It looks ok. But inline with the forum rules specify your Apache versions etc.
Try: to remove the both ProxyRequests Off and add ProxyRequests Off to the global conf (out side Virtualalhost).
Try global: ProxyPreserveHost On
Is the front SSL ?
Then you can try: SSLStrictSNIVHostCheck off |
|
Back to top |
|
cedricdaking
Joined: 22 Apr 2014 Posts: 11 Location: PARIS
|
Posted: Tue 22 Apr '14 14:09 Post subject: |
|
|
Hello,
Thanks a lot for your advice I have tried as you mention (see below), but I still have the same behaviour, all my request are redirected into the first virtual host entry.
For the moment it is only http.
I really don t know what to do at the point.
ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *>
ServerName xxxxx.com
ProxyPass / http://XX.XX.XX.XX/
ProxyPassReverse / http://XX.XX.XX.XX/
</VirtualHost>
<VirtualHost *>
ServerName support2.yyyyy.fr
ProxyPass / http://YY.YY.YY.YY/
ProxyPassReverse / http://YY.YY.YY.YY/
</VirtualHost> |
|
Back to top |
|
cedricdaking
Joined: 22 Apr 2014 Posts: 11 Location: PARIS
|
Posted: Tue 22 Apr '14 14:17 Post subject: |
|
|
Sorry I forgot to add the version :
apachectl -v
Server version: Apache/2.2.3
Server built: Mar 4 2010 09:57:54
Linux version
uname -a
Linux 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Tue 22 Apr '14 14:37 Post subject: |
|
|
Try to switch the Virtual hosts blocks: first YYY and then XXX, to see if he picks then the YYY one. |
|
Back to top |
|
cedricdaking
Joined: 22 Apr 2014 Posts: 11 Location: PARIS
|
Posted: Tue 22 Apr '14 14:41 Post subject: |
|
|
Thanks for your reply,
When I switch, it always take the first virtual host.
It goes to the YYY entry
Regards.
Cédric |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Tue 22 Apr '14 14:44 Post subject: |
|
|
The first VirtualHost section is used for all requests that do not match a ServerName or ServerAlias in any <VirtualHost> block.
Other rewrite rules and/or redirects in use ? |
|
Back to top |
|
cedricdaking
Joined: 22 Apr 2014 Posts: 11 Location: PARIS
|
Posted: Tue 22 Apr '14 15:45 Post subject: |
|
|
Thank in advance,
I don t think that there is any rewrite rules, I have checked (maybe you can tell me which clause I should check)
In a desesperate try, I have tried the fallowing but without more success.
In the log I have this entry :
109.190.96.111 - - [22/Apr/2014:15:34:28 +0200] "GET /sites/default/themes/paerpa/images/elmts/sep_menu_footer.png HTTP/1.1" 200 113 "http://support2.YYYY.fr/" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
So I dont get why it doesn t work...
<VirtualHost *>
ServerName www.YYYY.fr
ServerAlias YYYY.fr *.YYYY.fr
ProxyPass / http://10.253.11.31/
ProxyPassReverse / http://10.253.11.31/
</VirtualHost> |
|
Back to top |
|
jraute
Joined: 13 Sep 2013 Posts: 188 Location: Rheinland, Germany
|
Posted: Tue 22 Apr '14 20:17 Post subject: |
|
|
Hi Folks,
as far as i know it is not working with just 2 vhost-entries looking the same, like in this case <VirtualHost *>.
You need a NameVirtualHost *:80 entry which tells apache that you're going to use name-based virtual hosts.
And then you can use
Code: | <VirtualHost *:80>
DocumentRoot /www/abc
ServerName www.abc.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/xyz
ServerName www.xyz.com
</VirtualHost> |
That should be working for reverse proxy configurations as well.
Have a look at: http://httpd.apache.org/docs/2.2/vhosts/examples.html
Greets
JR
Last edited by jraute on Wed 23 Apr '14 10:42; edited 1 time in total |
|
Back to top |
|
cedricdaking
Joined: 22 Apr 2014 Posts: 11 Location: PARIS
|
Posted: Wed 23 Apr '14 10:40 Post subject: |
|
|
Thanks a lot I was missing the "NameVirtualHost *:80" entry, now it is working.
Thank you all. |
|
Back to top |
|
jraute
Joined: 13 Sep 2013 Posts: 188 Location: Rheinland, Germany
|
Posted: Wed 23 Apr '14 10:49 Post subject: |
|
|
Great!
You are always welcome. |
|
Back to top |
|