How can we help?

Search for answers or browse our knowledge base.

Table of Contents

Configuring Content Security Policy (CSP) for CAPTCHA

Content Security Policy (CSP) is a security standard used on websites to prevent attacks such as cross-site scripting (XSS) and other code injection attacks.

CSP works by adding several HTTP headers to the HTTP responses, which are sent when a website visitor tries to access your website. They inform website visitors’ browsers of the trusted sources from which scripts, images, and other components can be downloaded.

Potential CAPTCHA problems caused by CSP

When you add CAPTCHA to your website with CAPTCHA 4WP, a CAPTCHA check is run whenever a user loads the form/s on which the CAPTCHA check is included. For example, if you added Google reCAPTCHA, the website visitor’s browser must also load scripts from Google.com.

Therefore, when you have a Content Security Policy in place, you need to add specific HTTP headers to allow the loading of the CAPTCHA scripts from third-party sources; otherwise, CAPTCHA will fail to load.

This is a very common problem; below we explain how you can solve this issue.

Configuring CSP to allow CAPTCHA

CAPTCHA 4WP supports three different CAPTCHA providers; Google reCAPTCHA, hCaptcha, and Cloudflare Turnstile.

Below is a list of the directives you need to add to your CSP to allow any of these providers to work on your website.

Note: CSP configuration is typically done at the web server level. However, if you do not have access to the web server, as may be the case in a managed website environment, you can install a plugin that adds the HTTP headers.

Configuring CSP for Google reCAPTCHA

When using Google reCAPTCHA, you need to add the following directives:

  • script-src https://www.google.com/recaptcha/, https://www.gstatic.com/recaptcha/
  • frame-src https://www.google.com/recaptcha/, https://recaptcha.google.com/recaptcha/

For more detailed information, please refer to the reCAPTCHA FAQs.

Configuring CSP for hCaptcha

When using hCaptcha, you need to add the following directives:

  • script-src https://hcaptcha.com, https://*.hcaptcha.com
  • frame-src https://hcaptcha.com, https://*.hcaptcha.com
  • style-src https://hcaptcha.com, https://*.hcaptcha.com
  • connect-src https://hcaptcha.com, https://*.hcaptcha.com

For more detailed information, please refer to the hCaptcha documentation.

Configuring CSP for Cloudflare Turnstile

When using Cloudflare Turnstile, you need to add the following directives:

  • script-src https://challenges.cloudflare.com
  • frame-src https://challenges.cloudflare.com

For more detailed information, please refer to the Cloudflare Turnstile FAQs.

Verifying your CSP with a CSP Evaluator

Google has a CSP evaluator, which you can use to check your CSP setup. Whenever you change the CSP, it is highly recommended to test the setup, ensuring all the scripts and other third-party components are still loading.

Tip: If you are new to all of this and not sure from where to start, refer to Configuring HTTP security headers to WordPress for a guide on how to add the HTTP headers to your website using a plugin.

 Boost your sites’ security and management! Download our free eBook on WordPress oversight.

Uploading WP 2FA as a zip file in WordPress
WP 2FA in the WordPress plugin repository
Close

Installing WP 2FA Free

Congratulations on taking the first step towards enhancing your WordPress site's security with WP 2FA Free! You're now on your way to protecting your valuable data and ensuring peace of mind. No coding or technical knowledge is required.

 

Below are two ways to install WP 2FA on your website:

Go to your plugin dashboard on your site, then go to "Add New", and then search for WP 2FA.

Download the WP 2FA plugin zip, then select upload in your plugin dashboard under "Add New".

OPTION 1

OPTION 2

Uploading CAPTCHA 4WP as a zip file in WordPress
CAPTCHA 4WP in the WordPress plugin repository
Close

Installing CAPTCHA 4WP Free

Well done you. You're one step closer to safeguarding your WordPress website from spam and automated attacks with CAPTCHA 4WP. You'll be able to effortlessly integrate CAPTCHA into your forms and enjoy a website with enhanced security.

 

Below are two ways to install CAPTCHA 4WP on your website:

Go to your plugin dashboard on your site, then go to "Add New", and then search for CAPTCHA 4WP.

Download the CAPTCHA 4WP plugin zip, then select upload in your plugin dashboard under "Add New".

OPTION 1

OPTION 2

Uploading WP Activity Log as a zip file in WordPress
WP Activity Log in the WordPress plugin repository
Close

Installing WP Activity Log Free on your website

You deserve a pat on the back for choosing to record user actions and changes on your website. That is the first step towards better user accountability, easier troubleshooting of website security, and many other benefits of issues.

 

Below are the two ways to install WP Activity Log on your website:

Go to your plugin dashboard on your site, then go to "Add New" and then search for WP Activity Log.

Download the WP Activity Log plugin zip, then select upload in your plugin dashboard under "Add New".

OPTION 1

OPTION 2

Uploading Melapress Login Security as a zip file in WordPress
Melapress Login Security in the WordPress plugin repository
Close

Installing Melapress Login Security Free

Congratulations on taking control of your WordPress website's security by implementing robust login and password policies with Melapress Login Security. You can change your login page URL, limit failed login attempts, and reset passwords.

 

Below are two ways to install Melapress Login Security on your website:

Go to your plugin dashboard on your site, then go to "Add New" and then search for Melapress Login Security.

Download the Melapress Login Security plugin zip, then select upload in your plugin dashboard under "Add New".

OPTION 1

OPTION 2