Hi All,
In our dispatcher configuration we have the below include for custom variables -
Include conf.d/variables/custom.vars
Define BRAND_HTTP https://abc.com
We are defining a variable BRAND_HTTP which is set to abc.com.
We are further using the same configuration to set the X-Frame-Options as seen below
Header set X-Frame-Options "ALLOW-FROM ${BRAND_HTTP}"
Now in the Cloud Manager, the environment variable BRAND_HTTP is pointing to xyz.com
However, in the request URL we are only seeing the abc.com from the variables.
@arunpatidar @EstebanBustamante @aanchal-sikka @Rohan_Garg
Shouldn't the environment variable configuration be getting precedence?
We are already using environment variables to setup variables for ServerName and ServerAlias as seen below -
ServerName ${PUBLISH_BRAND_HOSTNAME}
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @NageshRaja,
Sorry for the delay in response - I think behaviour comes down to how and where the variables are evaluated within the Dispatcher configuration versus Apache’s environment variable system.
Apache Configuration -
Include conf.d/variables/custom.vars
Define BRAND_HTTP https://abc.com
Header set X-Frame-Options "ALLOW-FROM ${BRAND_HTTP}"
The issue is due to the difference between Apache Define
and environment variables (SetEnv
/ENV):
Define BRAND_HTTP https://abc.com hardcodes the value at Apache parse-time.
Even if the environment variable BRAND_HTTP=https://xyz.com
exists in Cloud Manager or the process environment, it will not override the Apache Define
.
The ServerName ${PUBLISH_BRAND_HOSTNAME} works because Adobe has patched the dispatcher pipeline to replace ${PUBLISH_BRAND_HOSTNAME}
with the environment variable before deploying.
That substitution is part of the Cloud Manager variable interpolation, which is allowed in limited directives — like ServerName
, ServerAlias
, VirtualHost
, etc. But not inside header values or arbitrary Apache directives like Header set
.
I hope this helps!
Regards,
Rohan Garg
can you try with the sytax as {env:your_variable_name}
The first check I recommend is to verify if the other variables expected for xyz.com are functioning correctly. If they are, the issue you are experiencing may be related to the order of the rules. In Apache, rules and configurations are evaluated in the order they are defined. If a configuration is listed earlier in the files, it may take precedence over later configurations unless it is explicitly overridden.
Hi @giuseppebag, The other variables are defined in environment variable in cloud manager are giving expected value for xyz.com
However, the case with this BRAND_HTTP is unique as it is defined in the custom.vars.
We have removed the value defined in custom.vars to allow the environment variable value to be picked up.
Views
Replies
Total Likes
Hi @NageshRaja,
As far as I know, Cloud Manager environment variables are not working on cloud dispatcher configuration. They don't have effect in config files.
I would suggest defining env variables in this way in custom.vars:
//this is a valud by default for prod
Define BRAND_HTTP https://abc.com
<IfDefine ENVIRONMENT_DEV>
Define BRAND_HTTP https://dev-abc.com
</IfDefine>
<IfDefine ENVIRONMENT_STAGE>
Define BRAND_HTTP https://stage-abc.com
</IfDefine>
Best regards,
Kostiantyn Diachenko.
We have defined the server name and aliases as below in vhosts file
ServerName ${PUBLISH_ATMOSPHERE_HOSTNAME}
The value is defined in cloud manager environment variables and it is picking the value correctly.
Views
Replies
Total Likes
@NageshRaja Did you find the suggestions helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Hi @NageshRaja,
Sorry for the delay in response - I think behaviour comes down to how and where the variables are evaluated within the Dispatcher configuration versus Apache’s environment variable system.
Apache Configuration -
Include conf.d/variables/custom.vars
Define BRAND_HTTP https://abc.com
Header set X-Frame-Options "ALLOW-FROM ${BRAND_HTTP}"
The issue is due to the difference between Apache Define
and environment variables (SetEnv
/ENV):
Define BRAND_HTTP https://abc.com hardcodes the value at Apache parse-time.
Even if the environment variable BRAND_HTTP=https://xyz.com
exists in Cloud Manager or the process environment, it will not override the Apache Define
.
The ServerName ${PUBLISH_BRAND_HOSTNAME} works because Adobe has patched the dispatcher pipeline to replace ${PUBLISH_BRAND_HOSTNAME}
with the environment variable before deploying.
That substitution is part of the Cloud Manager variable interpolation, which is allowed in limited directives — like ServerName
, ServerAlias
, VirtualHost
, etc. But not inside header values or arbitrary Apache directives like Header set
.
I hope this helps!
Regards,
Rohan Garg
Views
Likes
Replies