0

I am trying to add 2 headers to the .htaccess file but when the site is reloaded it gives a 500 internal server error

First header is:

Header set Content-Security-Policy: default-src https:

According to this website, this should allow any assets to load over https from any origin.

Second header is:

Permissions-Policy: geolocation=(self "https://example.com"), microphone=()

Obviously changing example.com to the proper domain, but the same website says this should work but also causes internal server error.

noname
  • 15
  • 1
  • 4

1 Answers1

0
Header set Content-Security-Policy: default-src https:

Syntax is wrong.

Header set Content-Security-Policy "default-src https:"

Is correct syntax.

In addition you should verify that mod_headers is enabled.

vidarlo
  • 6,654
  • 2
  • 18
  • 31
  • Hey, mod_headers is enabled as i have a bunch of others. Thanks for the answer, that fixed it, i also added unsafe-inline. Do you know what may be the issue with permissions-policy? I actually tried Header set Permissions-Policy geolocation=(self "https://example.com"), microphone=() - i removed the colon after policy but still 500 error – noname Feb 25 '22 at 13:02
  • If it fixed it, please accept the answer. Regarding your other line, read my answer again, and read the manual again. You're using the wrong syntax. – vidarlo Feb 25 '22 at 13:03