Error 500 Can Connect To Bad Hostname
Q&A Tutorials Poetry RecentThreads NewestNodes Donate What'sNew on Sep 13, 2009 at 06:05UTC ( #794967=perlquestion: print w/replies, xml ) Need Help?? alvise has asked for the wisdom of the Perl Monks concerning the following question: Hi there Monks: I wrote a LWP Perl script that posts a few data into a request to a web address. The script works fine from the command line, but when I execute the same script (using backticks) from within a CGI script launched by Apache, the request fails, and the status_line says "500 bad hostname". To prevent DNS issues, I added a line to /etc/hosts to resolve the web address with its corresponding IP, but this time I get "500 permission denied". Any suggestion about how to kill the "500 bad hostname" message ? Thanks in advance. Alvise.Comment on Bad hostname Replies are listed 'Best First'. Re: Bad hostname by Sewi (Friar) on Sep 13, 2009 at 08:55UTC Find a way to get debug messages from your script. This may be print STDERR, a temp log file in /tmp or anything else. Then print the exact URL you use for the LWP call and also the error message from your LWP handle. You may not call your script at all, you may get wrong parameters because of ', " or $ problems or something else. You should also print $ENV{http_proxy}, because your script may run in an environment which uses a proxy without your knowledge. If really everything is fine, try aprint logfile `ping -c 1 host.name.com 2>&1`; [download] [reply][d/l] Re^2: Bad hostname by alvise (Novice) on Sep 13, 2009 at 19:49UTC Hi Sewi: > Find a way to get debug messages > from your script. This may be > print STDERR, a temp log file > in /tmp or anything else. yes, I already print everything into a log file > Then print the exact URL you > use for the LWP call and also > the error message from your > LWP handle. the URL is fine > You should also print $ENV{http_proxy} no proxy found Anycase: the exact message that I get from the KWP user agent is the following: 500 Can't connect to www.sandbox.paypal.com:80 (Bad hostname 'www.sandbox.paypal.com') And if I add the hostname into /etc/hosts the status line turns to: 500 Can't connect to www.sandbox.paypal.com:80 (Permission denied) and this latter status line is also given if I change the URL with the corresponding IP: 500 Can't connect to 216.113.191.82:80 (Permission denied) but this doesn't prove anything because maybe there could be many virtual hosts with the same IP. Finally, as you are suggesting: > If really ev
This is most likely due to the system not being able to access our updates server. Go to Server > Networking > HTTPs and Proxy. Check http://www.perlmonks.org/?node_id=794967 proxy settings. If you are not using a proxy server these fields should all be blank. Depending on the browser you are using, username/passwords can get cached in these fields. http://kb.digium.com/articles/Configuration/The-Updates-page-now-shows-ERROR-500-Can-t-connect-to-80-Bad-hostname Remove any information from these fields and save your network settings. CAUTION: Saving HTTPs and Proxy settings will drop all calls. If there are not settings in these fields the other issue may be DNS. We recommend trying a generic DNS server out on the internet, such as 4.2.2.2, in order to isolate the issue to your DNS server. Go to Server > Networking > IP Configuration Add generic DNS server out on the internet, such as 4.2.2.2. CAUTION: Saving IP Configuration settings will drop all calls. Knowledgebase Home|Product
from LWP::UserAgent?? - PERL Modules I'm using LWP to POST some info from one Perl script to another, both on the same server/domain. It just happened to be the easiest implementation http://www.justskins.com/forums/bad-hostname-error-from-34320.html at the time... Anyway, the problem is that every now and then I get the following error from LWP: 500 Can't connect to [url]www.mydomain.com:80[/url] (Bad hostname 'www.mydomain.com') This script runs a few http://lists.w3.org/Archives/Public/www-validator/2004Oct/0187.html 1000 times per day, and it just started doing this yesterday. It usually works fine but I've received this error message maybe 20-25 times out of the past 2000 attempts. Anyone error 500 have any idea what's going on? Thanks, Ed... Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode May 20th,03:51 PM #1 Bad hostname error from LWP::UserAgent?? I'm using LWP to POST some info from one Perl script to another, both on the same server/domain. It just happened to be the error 500 can easiest implementation at the time... Anyway, the problem is that every now and then I get the following error from LWP: 500 Can't connect to [url]www.mydomain.com:80[/url] (Bad hostname 'www.mydomain.com') This script runs a few 1000 times per day, and it just started doing this yesterday. It usually works fine but I've received this error message maybe 20-25 times out of the past 2000 attempts. Anyone have any idea what's going on? Thanks, Ed Ed Eaton Guest May 20th,03:58 PM #2 Re: Bad hostname error from LWP::UserAgent?? Forgot to mention I'm running LWP 5.53. Thanks, Ed Ed Eaton Guest May 20th,04:20 PM #3 Re: Bad hostname error from LWP::UserAgent?? Ed Eaton wrote: > I'm using LWP to POST some info from one Perl script to another, both on > the same server/domain. It just happened to be the easiest implementation .... > It usually works fine but I've received this error message maybe 20-25 > times out of the past 2000 attempts. Anyone have any idea what's going on? "Bad hostname" often means DNS problems. Try adding the host name to /etc/hosts to avoid having to use an external DNS lo
[ Previous message ] [ Next in thread ] [ Replies ] From: J. Grant