Title: Error after adding header security code
Last modified: January 31, 2021

---

# Error after adding header security code

 *  [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/)
 * (@mushlih)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-after-adding-code/)
 * Hi
    I just added this code in my .htaccess file to resolve `Content-Security-
   Policy` problem:
 * `Header set Content-Security-Policy "default-src *; script-src *; style-src *;
   img-src *; connect-src *; font-src *; media-src *; report-uri *; child-src *;
   form-action *; frame-ancestors *; object-src *; frame-src *; worker-src *; manifest-
   src *; base-uri *"`
 * But after I added that code, the following error appeared on my wordpress:
    1.
   The [Site kit](https://wordpress.org/plugins/google-site-kit/) plugin logo becomes
   weird (enlarges on the wordpress dashboard) 2. The [WP Tab Widget](https://wordpress.org/plugins/wp-tab-widget/)
   plugin not working properly ([loading does’t stop](https://prnt.sc/xwsmpj)) on
   my site 3. The `Error Establishing a Database Connection` notification appears
   continuously, even though the settings in `wp-config.php` are correct 4. Error`
   Establishing a Database Connection` notification screen is different from usual(
   the writing is not neat)
 * And after I deleted that code, the problem disappeared
    How to fix it? Thank 
   you
    -  This topic was modified 5 years, 3 months ago by [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/).
    -  This topic was modified 5 years, 3 months ago by [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/).
    -  This topic was modified 5 years, 3 months ago by [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/).
    -  This topic was modified 5 years, 3 months ago by [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/).
    -  This topic was modified 5 years, 3 months ago by [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-after-adding-code/#post-13982505)
 * > I just added this code in my .htaccess file to resolve Content-Security-Policy
   > problem
 * I recommending asking the author of that cade you use.
 *  Thread Starter [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/)
 * (@mushlih)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-after-adding-code/#post-13984504)
 * However, is it true that I can put the code for my web header in the .htaccess
   file?
 *  [barnez](https://wordpress.org/support/users/pidengmor/)
 * (@pidengmor)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-after-adding-code/#post-13984818)
 * A content security policy must be tailored to each site. You cannot use a generic
   block of code, as every site is unique. Set the policy to `Report-Only` and experiment
   until no violation reports are generated, then you can remove the `Report-Only`
   directive and the CSP will be applied.
 * [https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only)
 *  Thread Starter [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/)
 * (@mushlih)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-after-adding-code/#post-13986200)
 * [@pidengmor](https://wordpress.org/support/users/pidengmor/) Sorry, can you simplify
   your words?
    I don’t really understand
 *  [barnez](https://wordpress.org/support/users/pidengmor/)
 * (@pidengmor)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-after-adding-code/#post-13987509)
 * You cannot copy and paste a content security policy to use in different websites.
   It will not work. Each website is different. You need to test the policy first.
   You test the policy by using the `Report-Only` directive. This allows you to 
   see the problems in the policy, without breaking parts of the site.
 *  Thread Starter [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/)
 * (@mushlih)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-after-adding-code/#post-13989870)
 * Ok, thank you very much

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Error after adding header security code’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 3 participants
 * Last reply from: [Mushlih Almubarak](https://wordpress.org/support/users/mushlih/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/error-after-adding-code/#post-13989870)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
