gongqin
gongqin

Reputation: 71

Multiple domains mixed up with SSL configuration with Apache httpd

I have two domains and 1 IP address. In my httpd.conf file, I added,

<VirtualHost *:80> 
ServerName www.domain1.com  
ServerAlias domain1.com
Redirect permanent / https://www.domain1.com/ 
</VirtualHost>

<VirtualHost *:80> 
ServerName www.domain2.com 
ServerAlias domain2.com
Redirect permanent / https://www.domain2.com/ 
</VirtualHost>

There are some cases that domain2 URLs are redirected to domain1 (pay attention to the url protocols).

For example, on iPhone/Safari, http://www.domain2.com http://domain2.com will both be redirected to https://www.domain1.com

On Windows using MSIE, http://domain2.com will both be redirected to https://www.domain1.com http://www.domain2.com works fine.

On Windows using Chrome, most of the cases work except, https://domain2.com will be considered insecure.

So this looks like a browser problem. Is there a way to prevent this from happening reliably?

Thanks.

Upvotes: 1

Views: 103

Answers (1)

Me Sa
Me Sa

Reputation: 1104

You can do this (it works for me):

<VirtualHost *:80>
  ServerName example1.com
  ServerAlias example1.com
  ProxyRequests off
  ProxyPass / http://127.0.0.1:9090/
  ProxyPassReverse / http://127.0.0.:9090/
</VirtualHost>

<VirtualHost *:80>
  ServerName example2.com
  ServerAlias example2.com
  ProxyRequests off
  ProxyPass / http://127.0.0.1:9091/
  ProxyPassReverse / http://127.0.0.1:9091/
</VirtualHost>

Upvotes: 0

Related Questions