puppetlabs-apache
puppetlabs-apache copied to clipboard
vhost headers interpolate string as variable
Describe the Bug
I am trying to set a header for a vhost I am declaring with hiera.
The header is:
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
To achieve this, I put the following into the hiera:
apache::vhosts:
'url-com-ssl':
servername: 'url.com'
headers:
- "add Set-Cookie \"ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/\" env=BALANCER_ROUTE_CHANGED"
This results in:
Header add Set-Cookie "ROUTEID=.e; path=/" env=BALANCER_ROUTE_CHANGED
It seems that the module/template interpolates the variable in the single quoted string resulting in an empty substring. This would make it hard/impossible to use the environment variables functionalities of apache.
I tried several different ways to escape the %{BALANCER_WORKER_ROUTE} part, but had no success. Maybe there is a way I am not aware of? Help is much appreciated.
Expected Behavior
I expected the apache module to set the header correctly without interpolating the string before writing it into the file.
Steps to Reproduce
- Setup the apache-module on the puppetmaster with hiera as described above
- Run the agent
- View the resulting output file
Environment
- Module-Version 8.2.0
- Platform SLES 12-SP5 (both master and agent)
- Puppetversion 6.28.0
- Puppetserver Version 6.20.0
Additional Context
If there is a way to correctly escape or configure variables in headers, it is not really apparent from the docs. Maybe there needs to be a bit more documentation, if this is not a bug?