Home > Mobile >  How To Enable CSP Apache/debian
How To Enable CSP Apache/debian

Time:10-06

I am A Front-end guy and need the help of a backend developer. I need to Fix the content security policies for a page I'm working on. I am just unsure of the syntax. I need to declare that script from self and the third party cdn's that I'm using are ok to load also the styles. I've looked everywhere and can't find anything that makes a clear picture this is what I,m trying.

    Header set Content-Secruity-Policy style-src 'self' code.ionicframework.com 

The error from apachectl configtest is header set has too many arguments. Can someone please explain what I'm doing?

CodePudding user response:

Please adjust your configuration by using double quotes "

Header set Content-Secruity-Policy "style-src 'self' code.ionicframework.com"

Then check for the syntax with apachectl configtest and finally reload | restart the apache service.

$ curl -IL http://domain-or-IP
HTTP/1.1 200 OK
Date: Tue, 05 Oct 2021 21:12:47 GMT
Server: Apache/2.4.25 (Debian)
Last-Modified: Tue, 05 Oct 2021 21:09:29 GMT
ETag: "29cd-5cda171fef842"
Accept-Ranges: bytes
Content-Length: 10701
Vary: Accept-Encoding
Content-Secruity-Policy: style-src 'self' code.ionicframework.com   <- HERE!
Content-Type: text/html
  • Related