gulp-community / gulp-livereload

gulp plugin for livereload
768 stars 67 forks source link

gulp-livereload doesn't work over https ? #82

Open heldrida opened 9 years ago

heldrida commented 9 years ago

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!

christian-fei commented 9 years ago

Did you find a solution for this issue?

chrisdhanaraj commented 9 years ago

@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).

jorgeriv commented 9 years ago

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?

adambiggs commented 8 years ago

+1

MrOutput commented 8 years ago

+1

leo commented 8 years ago

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.

MrOutput commented 8 years ago

@leo did you implement HTTPS?

leo commented 8 years ago

@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).

deini commented 8 years ago

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')
});
MrOutput commented 8 years ago

@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.

demurgos commented 6 years ago

We have a test checking for https support.

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