logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Reverse proxy with several websites ?
Author
cedricdaking



Joined: 22 Apr 2014
Posts: 11
Location: PARIS

PostPosted: Tue 22 Apr '14 12:04    Post subject: Reverse proxy with several websites ? Reply with quote

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: 3058
Location: Hilversum, NL, EU

PostPosted: Tue 22 Apr '14 12:34    Post subject: Reply with quote

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

PostPosted: Tue 22 Apr '14 14:09    Post subject: Reply with quote

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

PostPosted: Tue 22 Apr '14 14:17    Post subject: Reply with quote

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: 3058
Location: Hilversum, NL, EU

PostPosted: Tue 22 Apr '14 14:37    Post subject: Reply with quote

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

PostPosted: Tue 22 Apr '14 14:41    Post subject: Reply with quote

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: 3058
Location: Hilversum, NL, EU

PostPosted: Tue 22 Apr '14 14:44    Post subject: Reply with quote

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

PostPosted: Tue 22 Apr '14 15:45    Post subject: Reply with quote

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

PostPosted: Tue 22 Apr '14 20:17    Post subject: Reply with quote

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

PostPosted: Wed 23 Apr '14 10:40    Post subject: Reply with quote

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

PostPosted: Wed 23 Apr '14 10:49    Post subject: Reply with quote

Great!
You are always welcome.
Back to top


Reply to topic   Topic: Reverse proxy with several websites ? View previous topic :: View next topic
Post new topic   Forum Index -> Apache