Getting Google reCAPTCHA to Work Locally on Vagrant

Typically you can use “localhost” in the reCAPTCHA settings if you want to test your app locally, but if you’re using vagrant to manage your local servers this won’t work.

You won’t be able to use “localhost” or your custom hostname, such as “” that’s hard coded into your host file for local development with reCAPTCHA if you’re using vagrant.

You’re going to need to use theĀ IP address you assigned to the vagrant box when you created it. You can either view the config file related to the vagrant box or you can echo out $_SERVER[‘REMOTE_ADDR’] from your PHP app. That will give you the IP address that you can enter into the reCAPTCHA settings page next to your production URL.