網域/套件名稱驗證
reCAPTCHA 金鑰通常會與一組個別網域或套件名稱相關聯。對於網路使用者,API 金鑰組專屬於您指定的網域和第一層子網域。如果透過多個頂層網域為網站提供服務,指定多個網域會很有幫助。
舉例來說,如果您將 API 金鑰組指定至 yoursite.com,下表顯示 reCAPTCHA 是否適用於網域及其子網域變化版本。指定其他網域名稱或 TLD (例如:anothersite.com、yoursite.net 時),一樣適用 reCAPTCHA 條件。
指定網域 |
網站網域 |
reCAPTCHA 可以正常運作嗎? |
yoursite.com |
yoursite.com |
可 |
www.yoursite.com |
可 |
subdomain.<你的網站>.comyoursite.com |
可 |
subdomain.<你的網站>.comyoursite.com:8080 |
可 |
如要使用「localhost」進行開發,請將這個程式碼新增至網域清單中。
如果是行動裝置使用者,只有指定的套件名稱 (例如 com.google.recaptcha.test) 專屬 API 金鑰組。
不過,如果網域或套件名稱清單過長、沒有變化或不明,您可以選擇在 reCAPTCHA 端關閉網域或套件名稱檢查,改為檢查伺服器。
方法是在管理控制台中前往金鑰的「進階設定」,取消勾選「Domain/Package Name Validation」(網域/套件名稱驗證) 方塊。
安全性警告
如果自行停用這項防護功能,就會帶來重大的安全風險。金鑰遭停用的網站沒有限制,任何人都能自由使用該金鑰。因此,在驗證解決方案時,您「必須」檢查主機名稱/套件欄位,並拒絕來自非預期來源的任何解決方案。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-07-10 (世界標準時間)。
[null,null,["上次更新時間: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"]]