using reCAPTCHA globally #3279

Closed
opened 2025-11-02 05:06:27 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @BillSJC on GitHub (May 1, 2019).

  • Gitea version (or commit ref): 1.8.0
  • Git version: 2.17.1
  • Operating system: Ubuntu 18.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Thanks for the support of the reCAPTCHA, and i found its config here.

However, here is the problem that some region cannot access google domain google.com(such as China),so the reCAPTCHA cannot be used in these region. Currently I can only disable reCAPTCHA to make the website available for registration.

The official solution is replace www.google.com to www.recaptcha.net (see as recaptcha offical doc can-i-use-recaptcha-globally)

here are the doc

Can I use reCAPTCHA globally?

Yes, please use "www.recaptcha.net" in your code in circumstances when "www.google.com" is not accessible.

First, replace <script src="https://www.google.com/recaptcha/api.js" async defer></script> with <script src="https://www.recaptcha.net/recaptcha/api.js" async defer></script>
After that, apply the same to everywhere else that uses "www.google.com/recaptcha/" on your site.

Possible solution

Maybe a line can be added to the configuration file, such as

;Use www.google.com as default domain
;In some region which cannot access google.com, using www.recaptcha.net to get access
RECAPTCHA_DOMAIN = www.google.com

If u need replace the domain, just change it

;Use www.google.com as default domain
;In some region which cannot access google.com, using www.recaptcha.net to get access
RECAPTCHA_DOMAIN = www.recaptcha.net

Screenshots

Originally created by @BillSJC on GitHub (May 1, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.8.0 - Git version: 2.17.1 - Operating system: Ubuntu 18.04 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Thanks for the support of the reCAPTCHA, and i found its config [here](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.ini.sample#L361). However, here is the problem that some region cannot access google domain `google.com`(such as China),so the reCAPTCHA cannot be used in these region. Currently I can only disable reCAPTCHA to make the website available for registration. The official solution is replace `www.google.com` to `www.recaptcha.net` (see as recaptcha offical doc [can-i-use-recaptcha-globally](https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally)) here are the doc ### Can I use reCAPTCHA globally? Yes, please use "www.recaptcha.net" in your code in circumstances when "www.google.com" is not accessible. First, replace <script src="https://www.google.com/recaptcha/api.js" async defer></script> with <script src="https://www.recaptcha.net/recaptcha/api.js" async defer></script> After that, apply the same to everywhere else that uses "www.google.com/recaptcha/" on your site. ### Possible solution Maybe a line can be added to the configuration file, such as ```ini ;Use www.google.com as default domain ;In some region which cannot access google.com, using www.recaptcha.net to get access RECAPTCHA_DOMAIN = www.google.com ``` If u need replace the domain, just change it ```ini ;Use www.google.com as default domain ;In some region which cannot access google.com, using www.recaptcha.net to get access RECAPTCHA_DOMAIN = www.recaptcha.net ``` ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/enhancement label 2025-11-02 05:06:27 -06:00
Author
Owner

@BillSJC commented on GitHub (Oct 24, 2019):

It doesn't seem to been completely resolved

This change do fix the question that user cannot acces js files in some region. However, when i try to verify the whole login process, i found the request domain on gitea SERVER still be www.google.com when js file is from www.recaptcha.net . Then i still FAIL to finish the process.

If it's possible, request domain on gitea server can be configured as same as the js file's domain

@BillSJC commented on GitHub (Oct 24, 2019): It doesn't seem to been completely resolved This change do fix the question that user cannot acces js files in some region. However, when i try to verify the whole login process, i found the request domain on gitea SERVER still be `www.google.com` when js file is from `www.recaptcha.net` . Then i still FAIL to finish the process. If it's possible, request domain on gitea server can be configured as same as the js file's domain
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3279