1

I'm trying to have this working:

dev.somedomain.tld *.dev.somedomain.tld *.somedomain.tld

I created two SSL certs, one which contains dev.somedomain.tld and *.somedomain.tld, and the other contains *.dev.somedomain.tld.

I also created two VHost:

<VirtualHost 192.168.5.47:443>
  ServerName dev.somedomain.tld
  ServerAlias *.somedomain.tld 
</VirtualHost>

<VirtualHost 192.168.5.47:443>
  ServerName something.dev.somedomain.tld
  ServerAlias *.dev.somedomain.tld 
</VirtualHost>

Problem is: anything.dev.somedomain.tld goes to the dev.somedomain.tld vhost, no matter the priority in Apache.

Is there something special to do for higher level wildcards?

2
  • 1
    Have you tried to put VirtualHosts in another order? May be it works in Apache. :) May 9, 2017 at 22:09
  • Yes, I did try to reverse the order. That's why I said "no matter the priority in Apache". May 10, 2017 at 11:48

2 Answers 2

0

According Apache documentation VirtualHosts order matter. You could check VirtualHosts order by running httpd -S.

See my example with different VirtualHosts order:

[root@~]# httpd -S
VirtualHost configuration:
192.168.5.47:443       is a NameVirtualHost
     default server dev.somedomain.tld (/etc/httpd/conf/httpd.conf:353)
     port 443 namevhost dev.somedomain.tld (/etc/httpd/conf/httpd.conf:353)
             wild alias *.somedomain.tld
     port 443 namevhost something.dev.somedomain.tld (/etc/httpd/conf/httpd.conf:358)
             wild alias *.dev.somedomain.tld

[root@~]# httpd -S
VirtualHost configuration:
192.168.5.47:443       is a NameVirtualHost
     default server something.dev.somedomain.tld (/etc/httpd/conf/httpd.conf:353)
     port 443 namevhost something.dev.somedomain.tld (/etc/httpd/conf/httpd.conf:353)
             wild alias *.dev.somedomain.tld
     port 443 namevhost dev.somedomain.tld (/etc/httpd/conf/httpd.conf:358)
             wild alias *.somedomain.tld
0

Ok, so something.dev.somedomain.tld was in a file called "5-something.dev.somedomain.tld.conf" while "dev.somedomain.tld" was in "20-dev.somedomain.tld.conf". I was expecting something.dev.somedomain.tld to load before, but no, it loads after. I had to set the priority to "05" instead of "5", problem is gone.

1
  • That problem caused by sort. Alphabetical sort it as 20,5. After your fix sort looks like 05, 20. So order is matter. :) May 10, 2017 at 12:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .