域名/软件包名称验证
reCAPTCHA 密钥通常与一组单独的网域或软件包名称相关联。对于 Web 用户,API 密钥对与您指定的网域和第一级子网域是唯一的。如果您通过多个顶级网域提供网站,则指定多个网域会很有帮助。
例如,如果您将 API 密钥对指定为 yoursite.com,则下表显示了 reCAPTCHA 是否适用于相应网域及其子网域变体。如果您指定其他域名或 TLD(例如 anothersite.com、yoursite.net),则相同的 reCAPTCHA 条件适用。
指定的网域 |
网站域名 |
reCAPTCHA 可以吗? |
yoursite.com |
yoursite.com |
是 |
www.yoursite.com |
是 |
subdomain.yoursite.comyoursite.com |
是 |
subdomain.<您的网站.com>:8080yoursite.com |
是 |
如果您想使用“localhost”进行开发,则必须将其添加到网域列表中。
对于移动设备用户,只有指定的软件包名称(例如 com.google.recaptcha.test)对应的 API 密钥对是唯一的。
但是,如果您的域名或软件包名称列表非常长、非常灵活或未知,我们允许您在 reCAPTCHA 端关闭域名或软件包名称检查,改为检查您的服务器。
为此,请在管理控制台中,前往密钥的“高级设置”部分,然后取消选中“网域/软件包名称验证”复选框。
安全警告
关闭这项保护功能本身会带来巨大的安全风险,因为密钥在网站运行方面没有任何限制,所以任何人都可能拿走并使用您的密钥。因此,在验证解决方案时,您需要检查主机名/软件包字段,并拒绝来自意外来源的所有解决方案。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-07-10。
[null,null,["最后更新时间 (UTC):2024-07-10。"],[[["reCAPTCHA keys are linked to specific domains or package names for security."],["You can allow reCAPTCHA to work across multiple subdomains and domains by specifying them when creating the key."],["For local development, \"localhost\" needs to be added to the allowed domains."],["Disabling domain/package name validation in reCAPTCHA settings introduces significant security risks and requires server-side hostname/package verification."]]],["reCAPTCHA keys are tied to specific domains or package names. For websites, a key works for the specified domain and its first-level subdomains. Multiple domains can be added to a single key. For mobile apps, keys are tied to package names. If the domain/package list is extensive, checking can be disabled in the admin console's \"Advanced Settings.\" However, disabling it requires manual hostname/package verification on the server to prevent unauthorized use. Turning off domain or package checking without server side checking is a large security risk.\n"]]