使Google Recaptcha在域名中使用特殊字符 [英] Make google Recaptcha work with special charachters in the domain name

查看:812
本文介绍了使Google Recaptcha在域名中使用特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为网站设置了一个API密钥,其中包含域名中的瑞典字符ä(



希望它有帮助,会查看 stoken 方法


I was setting up an API key for a site with the swedish charachter ä in the domain name (http://sälja.io) but it did not initialize the recaptcha.

Then trying an api key for the equivalent url http://xn--slja-loa.io which worked when reaching the site from http://xn--slja-loa.io but not http://sälja.io.

Then I found the secure token which should work on all domains. It initialized the recaptchas on all domains and was also working on all tested domains, except the one with ä in it. https://developers.google.com/recaptcha/docs/secure_token

Is there any way to get it working also with ä in the domain name ?

Edit

Since an api-key for http://xn--slja-loa.io is working from android when accessing the site from http://sälja.io, it might be how the browser interprets the domain. Eg. firefox interprets http://sälja.io as domain http://sälja.io and cannot get a response from google servers that will not allow ä in domain names. Android inteprets http://sälja.io as http://xn--slja-loa.io and will get a response since it's not containing ä. Any thoughts about this ? Is there any way to force the browser to interpret http://sälja.io as http://xn--slja-loa.io ?

Edit2

Code examples can be reached on sälja.io/test, 178.62.187.163/test and xn--slja-loa.io/test

Edit3

As of today (25.11.2015) it seems not to be possible to use recaptcha with a special charachter like ä in the domain name. Since aishwat singh have been helping the most to coming to this conclusion within the time for the bounty he will be rewarded, however an answer will be accepted when a solution can be provided for this problem.

解决方案

I tried it just now and I am able to generate key for example-ä.se 6Ld8VRETAAAAALRXFNxmjEeVzbg2y5vdWv7THwJz

will post a complete working example shortly


EDIT 1

Here's git repo for code and same running on heroku

Ok it's not a complete fix because i used herokuapp.com as domain so example-ä.herokuapp.com becomes a sub domain and works

(however when earlier i tried it created a key for example-ä.se too but on loading page at captcha it gives invalid domain, figured out that was original issue, i thought you were not able to generate key for this domain)

Will try for a complete fix


EDIT 2

Btw you can specify your domain ip too, check this discussion

For me heroku free account doesn't provides ip of domain so it's difficult for me to test it

Also i was reading this thread

Figured out if i specify domains list as just com it accepts. In your case, just specify se as domains and it should work , google doesn't checks out exact url it just checks domain

Hope it helps, Will look into stoken approach too

这篇关于使Google Recaptcha在域名中使用特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆