5

I've been using Laravel Valet for while, and I've just encountered a situation that is working my last nerve: after creating a new Laravel project, I went to the public directory and did valet link my_project, then valet secure my_project. Now, valet links shows https://my_project.test but when going there, I get "Your connection is not private".

In Chrome, you can click on "Not Secure" and see the certificate, and when I do this, it shows the certificate for a different one of my projects! I have looked at my ~/.config/valet/Certificates directory, and the my_project.test files are all there (.conf, .crt, .csr, and .key). Any helpful suggestions would be most welcome.

Sachin Kumar
  • 3,001
  • 1
  • 22
  • 47
mpemburn
  • 2,776
  • 1
  • 35
  • 41
  • 1
    I ran into this exact issue yesterday after years without issue. I resolved it with an update of laravel valet and a restart of the service, followed by re-securing the site. – Rory Jan 10 '21 at 22:38
  • 1
    @Rory: Wow! That absolutely worked! Thank you! – mpemburn Jan 11 '21 at 14:08
  • Me also, looking through the [git commit](https://github.com/laravel/valet/tags) notes I can't identify the cause, but upgrading from Valet 2.11.0 (June 2020) to 2.13.16 (December) was enough to fix. – William Turrell Jan 12 '21 at 11:41

2 Answers2

8

Okay—thanks to @Rory, the problem is solved! Here are the steps:

  1. Run composer global update.
  2. Run valet restart.
  3. Do valet unsecure my_project, then valet unlink my_project.
  4. Do valet link my_project, then valet secure my_project

...and Bob's your uncle!

mpemburn
  • 2,776
  • 1
  • 35
  • 41
0

The answer above is correct, but if you are like me and use Firefox, you can get frustrated. The reason for this on Firefox is that this browser manages its certificates on its own, and not using the root certificates from your current computer. Because of this, you are required to import your Valet Root Certificate to the browser to allow this to open Valet website as secure.

Before fixing your browser, is important to know where your Valet setup stores the new CA Certificate:

~/.config/valet/CA/LaravelValetCASelfSigned.pem

I recommend you copy this file on your desktop to find it easily.

To fix your browser and make it work again with Valet you need to:

  • Open Firefox (Yes, I always assume the browser is closed).
  • Go to Settings (Triple bar icon on the right top corner) or CMD+,.
  • Click on Privacy and Security.
  • Scroll Down until you find Security > Certificates. Click on View Certificates....
  • On the new screen, Click on Authorities.
  • Scroll until the end of the screen (Be sure to scroll, because it looks like there's a nested scroll on that screen) until you find the Import... option.
  • Look for the LaravelValetCASelfSigned.pem file and click Open.
  • Click Ok and close and reopen your Browser.

Now your Firefox browser should work as expected.

Ricardo Vargas
  • 721
  • 4
  • 14