Apache and HTTPS Odd Behavoir

up-tech
up-tech used Ask the Experts™
on
I have quite a few vhost configurations on my servers, but lets take two for example:

site1.example.com and site2.example.com.

Site 1 vhost:

<VirtualHost *:80>
        ServerName  site1.example.com
        ServerAlias site1.example.com
       .....
</VirtualHost>

Open in new window


Site 2 vhost:
NameVirtualHost *:80
<VirtualHost *:80>
        ServerName site2.example.com
        ServerAlias site2.example.com
        Redirect permanent / https://site2.example.com/
</VirtualHost>

<VirtualHost *:443>
        ServerName  site2.example.com
        ServerAlias site2.example.com

Open in new window


The odd thing is, if I go to https://site1.example.com the server responds using the vhost conf and certificate of the site2 ssl configuration, any ideas?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fixer of Problems
Most Valuable Expert 2014
Commented:
I don't think you have identified the second one properly.  You may need
NameVirtualHost *:443

Open in new window

before the <VirtualHost *:443>.  More info from Apache here: https://wiki.apache.org/httpd/CommonMisconfigurations
Naranthiran DSystem Administrator

Commented:
Did you clear your browser history or cache and try..

Author

Commented:
Thanks Dave.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
You're welcome.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial