Apache and HTTPS Odd Behavoir

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

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 *: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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Naranthiran DSystem AdministratorCommented:
Did you clear your browser history or cache and try..
up-techAuthor Commented:
Thanks Dave.
Dave BaldwinFixer of ProblemsCommented:
You're welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.