gulp-livereload icon indicating copy to clipboard operation
gulp-livereload copied to clipboard

gulp-livereload doesn't work over https ?

Open heldrida opened this issue 9 years ago • 11 comments

I've been using livereload chrome extension that inserts a http://[...]/livereload.js into the document. Unfortunately, I'm working on a project that requires https and I expected to replicate that locally but I don't necessary have to do it as I can change the protocol for different environments, but I'm wondering if it's possible to set gulp-livereload to load via https instead ?

There's a few things I tried, such as adding the script manually without success, as I get a connection error (GET https://127.0.0.1:35729/livereload.js?snipver=1 net::ERR_CONNECTION_CLOSED):

var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://127.0.0.1:35729/livereload.js?snipver=1'; document.getElementsByTagName('body')[0].appendChild(script)

Any tips are appreciated, thanks!

heldrida avatar Apr 23 '15 09:04 heldrida

Did you find a solution for this issue?

christian-fei avatar Jun 06 '15 15:06 christian-fei

@christian-fei So the manual injection @heldrida did actually works, you just need to hit https://127.0.0.1:35729/livereload.js?snipver=1 in your browser first and tell Chrome that it's safe (since you're assumedly using an unsigned cert).

chrisdhanaraj avatar Jun 17 '15 17:06 chrisdhanaraj

livereload is not working for me either I'm using it like this:

    livereload.listen({
        key: read('ssl/ssl.key'),
        cert: read('ssl/ssl.pem')
    });

But the browser still says that blocked the script because of 'mixed content' which means that is still being loaded via http instead of https, any ideas?

jorgeriv avatar Aug 09 '15 05:08 jorgeriv

+1

adambiggs avatar Jan 22 '16 19:01 adambiggs

+1

MrOutput avatar Feb 12 '16 22:02 MrOutput

Hey, @heldrida! Just wanted to let you know that I've created a standalone fork of this repo, since it doesn't seem to be maintained anymore. You can find it here.

So I might be a good idea to re-open this issue there.

leo avatar Feb 17 '16 13:02 leo

@leo did you implement HTTPS?

MrOutput avatar Feb 17 '16 19:02 MrOutput

@MrOutput The above message was a friendly reminder suggesting to move the issue to the new, maintained repository (mine). Therefore: No, I haven't yet implemented HTTPS support (but I might as soon as the issue will be opened there).

leo avatar Feb 17 '16 20:02 leo

For anyone else who bumps at this, SSL works out of the box, just provide a key/cert. Something like:

livereload.listen({
    key: fs.readFileSync(path.join(__dirname, 'livereload.key'), 'utf-8'),
    cert: fs.readFileSync(path.join(__dirname, 'livereload.crt'), 'utf-8')
});

deini avatar Mar 14 '16 16:03 deini

@deini sweeeeet @jorgeriv mentioned that but noted issues. I ended up using the official livereload client and telling it to accept the suspicious code via the Shield icon in my browser. "Load unsafe script" haven't had an issue since.

MrOutput avatar Mar 14 '16 17:03 MrOutput

We have a test checking for https support.

Is this issue still valid? Could one of you confirm that HTTPS support works fine?

demurgos avatar Aug 28 '18 08:08 demurgos