简体   繁体   中英

reCaptcha show “input error: invalid referer”

I have registered an account on recaptcha.net with mydomain.com.

While I'm developing on my localhost it works fine, but whenever I try to open the page from another machine in my local network it shows "input error: invalid referer" error message!

I'm not using recaptcha plugins.

reCaptcha keys are tied to a certain domain + localhost (when you got your private/public keys from them). You can use it on another domain by requesting new private/public keys or by using a global key.

From their website :

  • By default, your reCAPTCHA key is restricted to the specified domain, and any subdomains for additional security. A key for foo.com works on test.foo.com.

  • If you wish to use your key across a large number of domains (eg, if you are a hosting provider, OEM, etc.), select the global key option. You may want to use a descriptive domain name such as "global-key.mycompany.com"

  • If you own multiple domain names (foocars.com and footrucks.com), you can sign up for multiple keys, or use a global key.

It seems that Google has removed the Global Key for reCaptcha, as you can see here .

In your localhost it works fine because your are using the keys provided to your domain. But when you upload the code you your production server, it seems that you are using the same keys to multiple domains (even though localhost might not be considered a domain). So you got that error. I fixed that creating new keys to another domain of mine and adding them to my localhost script. And to the production script, I kept the keys for that domain.

i have the same problem, i solve it to add my server ip adress from recaptcha admin screen ;

Click the over your domain name which are listed under header Your reCAPTCHA sites and add your ip at Key Settings -> Domain so problem is solved.

As Andre mentioned before - the global key was removed for reCaptcha. But you can use secure token You'll find my solution for PHP here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM