January 28th, 2022 by Alex Garrett-Smith

Enable HTTPS in Laravel Valet

By default, Laravel Valet doesn't use HTTPS. That's great, but if anything you're developing with locally requires HTTPS to be enabled, you're going to need it.

Luckily for us, it's easy to switch back and forth between a secured and non-secured site.

Enabling HTTPS

You just need to run this command

valet secure [site]

So for me, the command would be

valet secure codecourse

Now over in the browser, you'll be able to access (in my case) https://codecourse.test

You might need to tweak a few things, particularly if you're serving any assets from the http protocol, but generally everything should just work.

Disabling HTTPS

To disable, it's just as easy. Run the unsecure command.

valet unsecure [site]

And that's it! You can now easily switch back and forth between HTTP and HTTPS with Laravel Valet.