Search code examples
configurationwebserverubuntu-16.04apache2.4x-frame-options

Unable to set X-Frame Options on apache 2.4.18 server running on Ubuntu 16.04 lts


I am trying to set the X-Frame-Options to Deny on our webpage with the following: Header set X-Frame-Options DENY

apache2.conf file

All the documentation i can find says this is where it should be (inside the apache2.conf file).

But i keep getting this output after restarting the server

Output after restart

I have tried:

"Header set X-Frame-Options DENY"

"Header Set X-Frame-Options DENY"

"header set X-Frame-Options Deny

"HEADER set X-Frame-Options DENY"

"HEADER Set X-Frame-Options DENY"

and many more along the above pattern.

Again from all the documentation this should be as simple as adding one line of code or am I missing something blindingly obvious?

I have also tried creating a httpd.conf file and linking this with an include in the apache2.conf.

I managed to add the FileETag None with no problems however only really added this as a test to make sure i was adding the code to the right place.

Any suggestions why this would be happening?

I am new to web-server configuration so please be gentle in your replies :)


Solution

  • Ok.. So it turns out barely anywhere mentions to run sudo a2enmod headers first to enable to headers module.

    Also it turns out this is added in the security.conf file not the apache2.conf file