0

I want to set the Apache's header X-Frame-Options to "Deny" by adding the following line into the httpd.conf file on a single server using puppetlaps apache module.

Header set X-Frame-Options "DENY"

I have the YAML file for the server in the ../environments/data/node/server1.yaml I can edit this file to apply the config on this server only but I don't know what to put in it.

How to call the apache module so it can add the above line into the config file?

I tried the following but didn't worked:

apache::header::x-frame-options: 'DENY'

Update: Followed the advice below but still not working in my environment, l can't find another way to do it.

mmarkov
  • 3
  • 4

1 Answers1

0

In Puppet, headers are set in an instance of an apache::vhost defined type.

https://forge.puppet.com/modules/puppetlabs/apache/7.0.0/reference#headers

You'll either need to create an apache::vhost in a manifest

apache::vhost { 'example.com':
 [...]
 headers => 'set X-Frame-Options "DENY"',
 [...]
}

or use the apache::vhosts convenience class to do the same thing in Hiera

classes:
  - apache::vhosts

apache::vhosts::vhosts:
  'example.com':
    [...]
    headers: 'set X-Frame-Options "DENY"'
    [...]
Jon
  • 3,573
  • 2
  • 17
  • 24
  • Can I do it in the node yaml file? Im not sure how to do the above. Thanks in advance. – mmarkov Nov 18 '21 at 08:18
  • Yes, you should be able to do that in the node YAML. I'd note you need to flesh out that `apache::vhost::vhosts` hash with a lot of other stuff, which I'm not in a position to give you. Good luck! – Jon Nov 18 '21 at 16:15
  • Hi, this didn't work for me. Is there any other way of doing it? Thanks – mmarkov Nov 30 '21 at 07:43