Deploy Google ReCAPTCHA Mirror Website

0, Preface

As we all know, it is difficult to visit Google in China, but ReCaptcha is a free and reliable option for verification codes. At present, ReCaptcha V3 can keep most robots out.

There are similar ReCaptcha mirror stations in China:

ReCaptcha.net

Therefore, domestic servers can also use this mirror station as a source station to build a mirror station. The significance of self-built mirror station is to replace the resources called by ReCaptcha (located on Google's server) with your own CDN (such as Tencent Cloud), so that the loading speed can be accelerated.

1, PHP reverse proxy

Refer to the article on this site:

Reverse proxy website using open source PHP project
https://blog.tsinbei.com/archives/886/

The source site can choose www.google.com or recaptcha.net.

The following configuration is recommended:

replace

Text
1
2
3
www.google.cn/intl/zh-CN/policies/privacy/
www.google.cn/intl/zh-CN/policies/terms/
www.gstatic.cn

for

Text
1
2
3
blog.tsinbei.com/privacy.html
blog.tsinbei.com/agreement.html
cdn.tsinbei.com/gstatic

That is, the address of your privacy policy page, user agreement page, reverse proxy gstatic.com.

If not, you can leave it unset.

2, cross-domain settings

My CDN address is different from the domain name of the ReCaptcha mirror site, so I need to add it to the reverse proxy configuration file of the CDN:

Comment first then view it after your comment is approved. Join QQ Group to display all hidden texts.

Just these few lines, I read the document for a few days, and used Chrome’s DevTools to call them out one by one, which can guarantee to solve the cross-domain problem.

3, backend settings

To access the ReCaptcha server, you need to ensure that you can access ReCaptcha, and some areas of recaptcha.net seem to be parsed incorrectly, so you can use the national Ping tool, select a usable IP, and add it to /etc/host.

If the CDN part is pulled to cloud storage like me, you can manually replace the Logo:

/recaptcha/api2/logo_48.png

For example, I replaced it with my blog Logo:

Usage effect

At present, there is no effective way to replace the word reCAPTCHA with your own name, because it may accidentally damage the resource access address.

Deploy Google ReCAPTCHA Mirror Website

https://blog.tsinbei.com/en/archives/660/

Author
Hsukqi Lee
Posted on

2022-12-13

Edited on

2022-12-13

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet