Using hCaptcha or reCaptcha with OpenLiteSpeed

Panormitis

Verified User
Joined
Sep 13, 2014
Messages
51
Here's how to enable hCaptcha or reCaptcha with OpenLiteSpeed. I managed to make it work, so I'm posting it here, in case it's useful to anyone.
Keep in mind, if you use reCaptcha, v3 isn't supported. You must use v2 and not set a domain when you're generating site & secret keys.

Bash:
cd /usr/local/directadmin/custombuild/custom
mkdir -p openlitespeed/conf
cd openlitespeed/conf

# You could copy the file from:
# /usr/local/directadmin/custombuild/configure/openlitespeed/conf/httpd-lsrecaptcha.conf
# into this directory and edit it, or create a new file with the same name.
# I decided to create a new file:

nano httpd-lsrecaptcha.conf

# Paste the following:

lsrecaptcha  {
  enabled             1     # Set to 1 to enable it, or 0 to disable it.
  type                3     # Set your preferred captcha: 1 and 2 = reCaptcha. 3 = hCaptcha.

  siteKey             YOUR_SITE_KEY
  secretKey           YOUR_SECRET_KEY

  regConnLimit        100   # Captcha will appear after this many connections from the same IP.
  sslConnLimit        100   # Captcha will appear after this many connections from the same IP.
  maxTries            3     # If captcha appears, the user has 3 tries to solve it.

  allowedRobotHits    5     # How many times an allowed bot from the list below, can index the same URL in a period of 10 seconds.
  botWhiteList {
    Googlebot
    Google-InspectionTool
    Mediapartners-Google
    Bingbot
    Slurp
    AhrefsBot
    SemrushBot
    PetalBot
    DuckDuckBot
    Baiduspider
    YandexBot
    Applebot
    facebookexternalhit
    Facebot
    Twitterbot
    LinkedInBot
    Pinterestbot
    WhatsApp
    TelegramBot
    Slackbot
    Discordbot
  }
}

# Save the file and then:
da build openlitespeed
 
Last edited:
Back
Top