Expand my Community achievements bar.

Restrict ServerAlias domain in dispatcher based on environment

Avatar

Level 3

Hi All,

 

I have a requirement to remove one domian name from  serveralias configuration from one specific environment.

 

We are using 4 domain names for serverAlias configuration in vhost , but in one of the domain name is matching the stage/prod domain url then i have to remove the particular domain name from serverAlias configuration.

 

I tried with something like this, but it's not working.

<If "${DomainA}=='stage.domain.com'">

ServerAlias ${DomainB} ${DomaiC} ${DomainD}

</If>

<Else>

ServerAlias ${DomainA} ${DomainB} ${DomaiC} ${DomainD}

</Else>

 

Could any of you please suggest how to implement this requirement.

 

Thanks

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Level 5

Hi @prashanth55 ,

If you need to provide a different configuration for an environment try the following configuration.

customs.vars:

Define SERVER_ALIASES "${DomainA} ${DomainB} ${DomaiC} ${DomainD}"
<IfDefine ENVIRONMENT_STAGE>
    Define SERVER_ALIASES "${DomainB} ${DomaiC} ${DomainD}"
</IfDefine>

 vhost configuration:

ServerAlias ${SERVER_ALIASES}

 

Best regards,

Kostiantyn Diachenko.