问题
I am developing using vagrant. I'd like to use reCapcha how ever I get an error when when I'm developing on local machine which is at a subdomain on the vagrant configured private network 192.168.100.100:
ERROR for site owner:
Invalid domain for site key
The recaptcha works on the production site fine. How can I setup my development environment to work with recaptcha?
In the vagrant bootstrap are the following:
<Directory "/var/www/">
AllowOverride All
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www/app
ServerName app.dev
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/phpmyadmin
ServerName phpmyadmin.dev
</VirtualHost>
I've tried adding locahost and 192.168.100.100 to my recaptcha key settings but this hasn't worked.
回答1:
Add your domain to /etc/hosts
with your local vargrant IP. Then visit your domain in a browser and it should be working.
来源:https://stackoverflow.com/questions/47439938/how-do-i-use-recaptcha-in-a-vagrant-development-environment