Google reCaptcha is a free service that protects your site from spam and abuse. It is easy to set and use on any website. If you are a web developer and you migrate the existing site to your localhost. When you are developing the website on localhost, on the form that you integrate the reCaptcha(V2 or V3) shows you, the error says “Localhost is not is the list of supported domains“. Well, there is a reason why and a solution to it.
According to the reCaptcha Developer’s Guide:
localhost domains are not supported by default. If you wish to continue supporting them for development you can add them to the list of supported domains for your site key. Go to the admin console to update your list of supported domains. We advise to use a separate key for development and production and to not allow localhost on your production site key.
As the guide says, go to the admin console and add the “localhost” into the same site you are developing on your localhost.
Example, I already add the “example.com” for reCaptcha then I migrate the site to my localhost. In order to remove the error, I will edit the example.com record by adding a localhost domain. This way, I will use the same site key with example.com.
figure: where to add the localhost domain
Yeap! it is easy and fast.