Testing a Service Worker with a Self-Signed SSL Certificate in Google Chrome

For local development I use the default snake-oil certification which is self-signed. Chrome will throw an error and not load the service worker when this certification is encountered. In Ubuntu you can start Chrome from the command-line using the following arguments.

  • --ignore-certificate-errors
  • --unsafely-treat-insecure-origin-as-secure=https://loc.jasonsnider.com (This Must match the name of the domain using the snake-oil cert.)
  • --user-data-dir=/home/jason/test/only/profile/dir (I had to create this directory)

Replace https://loc.jasonsnider.com with the name of your dev site. Replace /home/jason/ with your directory path.

mkidr -p /home/jason/test/only/profile/dir
google-chrome  --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https://loc.jasonsnider.com --user-data-dir=/home/jason/test/only/profile/dir

LinkedInGitHubTwitter