[Plugin: Broken Link Checker] Connection Failed: couldn't connect to host [Error (4 posts)

  1. Russell Heimlich
    Posted 3 years ago #

    I understand this is a networking/firewall issue and not an issue with the Broken Link Checker plugin. I see it is using cURL to fetch the URLs so I SSH'd into my production machine and typed this:

    curl http://people-press.org/about/danielle-gewurz/

    Which returned...

    curl: (7) couldn't connect to host

    Alright time to talk to my network administrators. They said this:

    "Generally, at most shared hosting companies the servers are directly on the internet. Here we put the serves on an internal private network and then NAT to the internet.

    The curl command will have to connect directly to the private IP address of the server. In this case for XXXXXX that would be So, the command would be as follows.

    curl -H "Host: people-press.org""

    I take it I'll need to hack the Broken Link Checker plugin to make it work with my unusual set-up. Unless anyone else has a better idea?

  2. Russell Heimlich
    Posted 3 years ago #

    Oh yea forgot to mention I'm running a multisite set-up if that should matter at all. Some hooks and filters for this plugin would be greatly appreciated.

  3. Janis Elsts
    Posted 3 years ago #

    For what it's worth, the relevant code is in /broken-link-checker/modules/checkers, probably around line 147. You'll need to replace the hostname in $url with the IP and add the Host header to the CURL handle. Something like this:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: xxxx'));

    If you have specific suggestions for hooks/filters that would be useful to add, let me know.

  4. Russell Heimlich
    Posted 3 years ago #

    Well it turns out I didn't need to fork this plugin and modify it after all. A simple change to the Hosts file on the server did the trick. Thank goodness.

Topic Closed

This topic has been closed to new replies.

About this Topic