Anuj Kulkarni
Anuj Kulkarni

Reputation: 2199

Recaptcha connection timeout on the linux server

I am using ReCaptcha for captcha on my website. It runs all right when I run it on a localhost server. But when I am running it on a linux server, it gives me connection time out message. I am not sure why ?

I see that many people have had the same issue, but no resolution does anyone know what might be the issue ? I am using the Java example given in the documentation.

here it is -> https://developers.google.com/recaptcha/docs/java


net.tanesha.recaptcha.ReCaptchaException: Cannot load URL: Connection timed out
    at net.tanesha.recaptcha.http.SimpleHttpLoader.httpPost(SimpleHttpLoader.java:89)

My iptable settings for port 80 are :

-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT

I tried to curl

 http://www.google.com/recaptcha/api/verify 
from the web server and it did not allow. I guess the host is not reachable from the server. How to allow post/get from the linux server to the google api website ?

Upvotes: 0

Views: 2522

Answers (1)

Sergey Serov
Sergey Serov

Reputation: 111

1). Error in Your INPUT chain:

-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

Here must be --sport not --dport. Because curl may use any port for new output request and will be waiting response on it. For example 44254 or any other.

2). May it will be necessary to add also similar rule for 443 port, because new version of Google RECaptcha use it by default.

Upvotes: 0

Related Questions