Valet - This Site Can't Be Reached - Chrome

Written by Rich Banks on 31st Dec, 2017

Laravel

I recently moved over to a new laptop and decided to try Laravel Valet instead of Homestead. The reason I decided to try Valet was that it is very lightweight, fast and seemed less of a burden on my laptop than a Homestead virtual machine.

Valet is perfect for my requirements and I cant see myself moving back over to Homestead. However, after a couple of weeks of using Valet trouble free, I stumbled across a problem. I cloned a remote repository I had not worked on for a while, tried to fire it up in Chrome and was met with a "This Site Can't Be Reached" Error. After 20 minutes or so of checking my cloned files, I decided to see if the problem was with Valet rather than my repository. I tried to open a site I was working on yesterday to find that I got the same error.

I then noticed that the site was trying to be served over HTTPS rather than HTTP that I had been using up until now. After a little digging, I found that Chome had recently decided to force HTTPS for .dev domains.

There are a couple of ways to fix this. The easiest, and what I did to get my dev sites working again, was to run the below from the terminal (where your site is being served on site.dev):

valet secure site

Valet will now secure your site.dev with a fresh TLS certificate which resolves this error.

An alternative way to resolve this issue is to change the domain TLD Valet uses. As far as I am aware Chrome is only forcing .dev and.app domains over HTTPS. You can do this by running the below in the terminal:

valet domain test

Valet will now serve your projects using .test.