Solution reCAPTCHA Failed to open stream: Connection timed out

Once on one server, on all pages where reCAPTCHA was used, they stopped working: contact form, forum registration form, password recovery forms, etc.

At first it turned out that IPv6 stopped working, so the server could not establish a connection with Google, since IPv6 was not used on this server, then I turned it off:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6
1
cat /proc/sys/net/ipv6/conf/eno1/disable_ipv6
0

echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/eno1/disable_ipv6

See my article – Disabling IPv6 on Linux

I note that IPv6 was disabled earlier, but since the IPv6 parameters were specified in netplan in other places, IPv6 was activated on the eno1 network interface.

A little later, the DNS server also stopped working at the hosting provider, I checked it with the usual ping command:

ping google.com

To solve this problem, I added some DNS to /etc/resolv.conf and also specified them in the network configuration /etc/netplan/.
After that, the problem with reCAPTCHA was solved.

See also my articles:
How to configure networking with Netplan
Configuring the Network in Linux

Leave a comment

Leave a Reply