I have the next code on a .htaccess file
<IfModule mod_headers.c>
Header set Content-Security-Policy "base-uri http://site.local/"
Header append Content-Security-Policy "default-src 'none'"
Header append Content-Security-Policy "connect-src 'self'"
Header append Content-Security-Policy "style-src 'self'"
Header edit Content-Security-Policy "," ";"
</IfModule>
which generates the next response header from the server:
Content-Security-Policy base-uri http://site.local/, default-src 'none', connect-src 'self', style-src 'self'
I want to get that line with semicolons instead of commas, like this:
Content-Security-Policy base-uri http://site.local/; default-src 'none'; connect-src 'self'; style-src 'self'
Using append or merge on Apache's mod_headers separates the different additions to the header previously set with a comma, as the standard seems to point, but the W3C dictates that the different configurations of the Content Security Policy have to be separated with a semicolon.
I can't find a way to write the Header edit line to replace the ',' with ';' as per the W3C states.
I have tried many variations for the search, I know that some are wrong but since I'm not getting the expected results I'm trying anything that I can think of.
I have tried patterns like this:
What am I missing?
Header directive accepts two different arguments in order to perform a substitution. The one that performs a global match has a trailing asterisk edit*. From documents:
The
editform will match and replace exactly once in a header value, whereas theedit*form will replace every instance of the search pattern if it appears more than once.
You need edit* as in:
Header edit* Content-Security-Policy , ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With