putyourlightson/craft-sherlock

Unable to connect to [URL]. Please ensure that the site is reachable and that the system is turned on.

Closed this issue · 13 comments

Hi there, I've installed the 'Lite' version of Sherlock on a site, but when I try to run a scan I'm getting the above error message. The URL definitely exists!

In the Sherlock log, I'm also getting the following cURL error, which suggests Sherlock is somehow adding an extra www:

cURL error 6: Could not resolve host: www.www.[domain] (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

Steps to reproduce the behaviour:

  1. Install Sherlock
  2. Click on "Run Scan Now"
  • Sherlock version: 3.1.1
  • Craft version: 3.5.5

Can you double check that your site's base URL is correctly set?

Can you double check that your site's base URL is correctly set?

Yep, I've double and triple checked, and it's correct.

Is it an absolute path or are you using an alias or environment variable? Is this a multi-site setup?

It's an absolute path, and it's just a single site setup.

We're force applying www in the .htaccess file, so I'm wondering if this could be an issue?

That could very well be the issue, can you try disabling it, assuming this is in local dev?

Right, I just tried on our staging site without the www redirect and the scan now works.

Great, so sounds like you just need to tweak that redirect.

I'm getting the same error on my local dev setup (using Nitro 2) with the "Lite" version installed. The error log appears to show that the issue is because there's a connection issue with my domain on port 443.

cURL error 7: Failed to connect to [domain] port 443: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

Running nitro portcheck 443 shows that 443 is in use. On my Mac, I also see that 443 is being used for one of my apps. Not sure if those are the same, though, given that Nitro is running within Docker containers.

Craft CMS: 	 3.6.16
Sherlock Lite: 	 3.1.3
Nitro CLI: 	 2.0.8
Nitro gRPC: 	 2.0.8
Docker API: 	 1.41 (1.12 min)
Docker CLI: 	 1.41

I believe that Nitro sites require a different internal URL when initiated from the container, which is the case here.

@bencroker Is there a way to work around this so that Sherlock can identify what the URL is?

Not currently, but you are welcome to add a new feature request issue. Running Sherlock scans in a local development environment should anyway only be for testing, in staging/production is where it really counts.

Gotcha. No problem. Thanks, Ben!