• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Outgoing HTTP Request not working

D

dbunn

Guest
Hi,

I have a linux box with plesk 7.5.4 and a script that makes a http request to www.google.ca.

The response to the http request is
500 Can't connect to www.google.ca:80 (Bad hostname 'www.google.ca')

The same script works on 2 other linux boxes (which do not have plesk).

I have tried stopping the firewall and I still cannot make a successful http request.

Can somebody help please ?

Thanks.
 
1. Can you post the section of your script which performs the request?

2. Can you SSH into the server and verify that you can ping 'www.google.ca'?

3. Or do a dig to make sure your server is able to resolve the IP

4. Is your perl version the same on the Plesk and non-Plesk servers?

5. Is it possible that Google has blocked your IP for some reason?

Just some things off the top of my head...
 
Thanks for the feedback, below are my responses to your questions

IPTABLES -L - cannot run this it is not recognised ? cannot find IPTABLES in path.

1. Can you post the section of your script which performs the request?

use HTTP::Request;
use LWP::UserAgent;
use CGI;

$request = HTTP::Request->new(GET => 'http://www.google.ca');

$ua = LWP::UserAgent->new;
$ua->protocols_allowed( [ 'http', 'https'] );

$response = $ua->request($request);

$cgi = new CGI;
print $cgi->header;
print $response->status_line;


2. Can you SSH into the server and verify that you can ping 'www.google.ca'?

yes

3. Or do a dig to make sure your server is able to resolve the IP
did 2 so assume I do not need to do this.

4. Is your perl version the same on the Plesk and non-Plesk servers?

no they are different perl versions on my plesk machine it is 5.8.5, on my non-plesk machine it is 5.6.1


5. Is it possible that Google has blocked your IP for some reason?

I don't think so, this was just a test to see if I could make a http request from a script.
 
If you Google on the error, and read enough of the hits, you will see a number of other people complaining that their same/similar request scripts are now failing "after upgrading perl" on their systems.

This leads me to think that since the perl version on your Plesk server is newer than the other 2 servers where the script works, that it may be a problem with the perl version.
 
Thanks once again,

I've tested a http request on the plesk server using php and python and they both work.

So it does indeed look like the problem is linked to perl.

Thanks.
 
Back
Top