Testing service workers on custom local domain with self signed certificate

When playing around with service workers in order to make a site a progressive web app I had to test it on my local dev environment. As service workers need to run on https and I use a self-signed certificate for development. This gave me the following error in the console in Chrome

ServiceWorker registration failed: DOMException: Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script.

The solution is to tell Chrome to accept the certificate even though it is insecure from Chrome’s point of view.

Read more

Create additional databases in Laravel Homestead

It is really easy to ad more databases in Laravel Homested. Simply edit the Homestead.yaml file (in Windows under C:Usersyour-username.homesteadHomestead.yaml)

Under databases add your databases like this:

# content above omitted

databases:
    - homestead
    - my_new_database
    - another_database

# content below omitted

If you virtual machine is already running navigate to your Homestead folder and run the command vagrant provision to create the new database(s). If it is not running simply run vagrant up.

Read more