Hello,
Nowadays security headers are automated by the webhost, ex: Kinsta. RunCloud does it too and handles HSTS as well from the CP. I don't know if Enhance will include a way to manage security headers from the dashboard.
Test your domain using: https://securityheaders.com/
If you want to implement a security header, there are many ways to do so and at diff layers:
- App level: Ex with WP: inserting it in your htaccess file or in your functions php or even creating a plugin
- Server level: Ex with LiteSpeed by editing a virtual host or creating a virtual host template and applying it to whatever VH you want. Or if using NginX in nginx.conf
Once Enhance launches Immunify360 maybe there would be a way to do that but not certain because I'm not familiar with immunify360
- At the CDN level: Ex with CF using Workers
I have chosen the app. level route through .htaccess. Why? Because if you're not hosting only WP sites it is impossible to have a universal security header for all applications. Ex: CSP (content-security-policy highly depends on how your application works and there's def not one policy fit all). I'm also using LSE which handles .htaccess.
Why not at the CDN level using CloudFlare for instance? I tried but realized that:
- it just applies when traffic is routed through Cloudflare, if unproxied or you once want to switch CDN you lose your security headers.
- if someone calls your page and resolved your domain directly to your origin IP all the security features do not apply.
- you are depending on Cloudflare
- you don’t use any free Cloudflare rules for things that are solvable differently/better
I'm still learning LSE web server so I can't bring anything yet on that topic but if you know something useful that could help, please share :-)
Applied to WordPress here's a good security header (+ other security measures included) I've found compatible with WP 6.3 and FSE. It won't break your WP site or the backend. It contains a loose CSP just for the sake of passing the test (https://securityheaders.com/). Paste this at the top of your WP .htaccess file and you should be good to go.
### BEGIN WP 6.3 Security - AUGUST 2023 - LSE
## Automatic 301 redirect to https
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
## Additional security headers
<ifModule mod_headers.c>
# X Frame Options
Header always set X-Frame-Options "SAMEORIGIN"
# X XSS-Protection (deprecated)
Header set X-XSS-Protection "0"
# X Content-Type-Options
Header set X-Content-Type-Options "nosniff"
# X Permitted Cross Domain Policies
Header set X-Permitted-Cross-Domain-Policies "none"
# X-Powered-By and Server
Header unset X-Powered-By
Header unset Server
# Enable Strict Transport Security
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS
# Referrer Policy
Header set Referrer-Policy "strict-origin-when-cross-origin"
## Advanced policies - basic implementation
# Feature Policy (rudimentary policies supported by most browsers)
Header set Feature-Policy "microphone 'none'; camera 'none'"
# Permissions Policy (rudimentary policies supported by chrome and FF)
Header set Permissions-Policy "autoplay=(self), encrypted-media=(self), fullscreen=(self), geolocation=(self), midi=(self), payment=(self)"
# Content Security Policy (CSP - quite lax WP 6.3 compatible policies)
Header set Content-Security-Policy "default-src 'self'; object-src 'none'; script-src 'self' https: data: blob: 'unsafe-inline' 'unsafe-eval'; connect-src 'self' https:; style-src 'self' https: 'unsafe-inline'; font-src 'self' data: https:; img-src 'self' blob: data: https:; frame-src 'self' https: blob:;"
</IfModule>
## ForceSecureCookie (LiteSpeed Set Cookie HTTPOnly Secure alternative)
<IfModule LiteSpeed>
ForceSecureCookie same_site_strict
</IfModule>
### END Improved Site Security August 2023
PS: I am in no way a security expert, a devOps or a technical expert. All I share here is what I found on the Web and that I am using on my own WP site. Therefore, if you have more experience on that topic I'd be happy to read and learn from you.