Skip to content

livereload with mkcert file pairs for https #573

@dwlamb

Description

@dwlamb

I am trying to configure grunt-contrib-watch livereload to work with a local development server which has https characteristics using mkcert. Not succeeding finding an example specific to mkcert, I tried adapting the example from the documentation for SSL key/cert file pairs. This:

watch: {
  css: {
    files: '**/*.sass',
    tasks: ['sass'],
    options: {
      livereload: {
        host: 'localhost',
        port: 9000,
        key: grunt.file.read('path/to/ssl.key'),
        cert: grunt.file.read('path/to/ssl.crt')
      }
    },
  },
},

adapted to:

watch: {
  css: {
    files: '**/*.sass',
    tasks: ['sass'],
    options: {
      livereload: {
        host: 'localhost',
        port: 9000,
        key: grunt.file.read('path/to/test.com-key.pem'),
        cert: grunt.file.read('path/to/test.com.pem')
      }
    },
  },
},

It did not work. grunt returned the following.

Error: Unable to read "path/to/test.com-key.pem" file (Error code: ENOENT).
Warning: Task "default" not found. Use --force to continue.

What is the method for using livereload on https sites using mkcert?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions