Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM Cloud: its ignoring all vhosts in enabled_vosts except default.vhost

Avatar

Level 9

This is strange. AEM displather has 2 dirs under conf.d:

available_vhosts

enabled_vhosts

 

What we have found is AEM ignores all xxx.vhosts files in enabled_vhosts except for one called default.vhost.

 

in avaliable_vhosts we have 3 xxx.vhost files

in enabled_vhosts we create a symbolic link to each.

only default.vhost is actually used.

 

Our workaround is to put all our vhosts in into default.vhost, but its not ideal.

 

Anyone else have this issue?

 

All our vhosts look like this:

 

<VirtualHost *:80>

ServerName "somesite_com"

ServerAlias "oursite-dev.ourdomain.net"

ServerAlias "oursite-test.ourdomain.net"

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Correct, zzz is in the C collation after 999

View solution in original post

6 Replies

Avatar

Level 9

Well, I found the problem, but not a real solution.  

the problem is that one of the vhosts had "ServerAlias *". Removing this, allows all our vhost files to be correctly read and used. However, now we are seing some strange inexplicable problems with our site, and one of the devs says the severalias * is required by adobe to work. This means, to ensure this directive is the very last one, we have to put all our many virtual hosts entries into one giant vhost file, and put the * allies on the last of them.  This means we cant use any of the nice available/enabled functionality - we have to edit the file to add/remove virtual hosts.

Avatar

Employee Advisor

That explanation is technically correct, but I just want to give some more context.

 

In this case the order matters. If a request comes in and the correct vhost is about to determined, a "ServerAlias *" is a catch-all definition, and it will be used. So you should make sure that this definition is the last one to be loaded. More specific vhosts should be loaded before.

 

So you can try to rename the "default.vhost" to "999_default.vhost" (alphabetical order matters here) and try again.

 

Would love to hear if this helps.

 

Jörg

 

Avatar

Community Advisor

@Jörg_Hoh - Changing the default.vhost to 999_default.vhost also didn't help - The default.vhost was loaded first. Changing it to zzz_default.vhost worked as that ensured the default.vhost is the last to be loaded.

Avatar

Correct answer by
Employee Advisor

Correct, zzz is in the C collation after 999

Avatar

Community Advisor

@TB3dock @Jörg_Hoh  @Rohan_Garg  @kautuk_sahni 

It's working as expected, you are facing this issue because you are using "" (Quotes) with the ServerAlias. It should be without quotes and you can name the vhost files with the following order,

 

001_firstdomain_com.vhost

002_seconddomain_com.vhost

default.vhost

 

Thanks,
Asutosh

Avatar

Level 1

Hello This indeed work but it would be incredibly useful if this is documented somewhere instead of letting developers wonder around in loop not knowing why their hosts are not matching. Especeially since the config works with the local sdk.