Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Enable an https lr server #21

Merged
merged 1 commit into from

5 participants

@joeybaker

By passing the contents of cert files, we can enable an https version of the lr server which is super handy for debugging https.

@joeybaker joeybaker Enable an https lr server
By passing the contents of cert files, we can enable an https version of the lr server which is super handy for debugging https.
68db18b
@joeybaker joeybaker referenced this pull request in gruntjs/grunt-contrib-watch
Closed

Enable live reload to work over https connections #197

@leog

Waiting for this merge!

@joeybaker

@mklabs any thoughts on this?

@mklabs
Owner

That looks good, thanks a lot.

@mklabs mklabs merged commit 12c125e into from
@mklabs
Owner

I'll bump version to 0.0.5 and publish to registry once I get the chance, thanks again.

@joeybaker joeybaker deleted the branch
@joeybaker

@mklabs cheers sir!

@joeybaker joeybaker referenced this pull request from a commit in joeybaker/grunt-contrib-watch
@joeybaker joeybaker Enable live reload to work over https connections 39c6a55
@advanderveer

Shouldn't the _uri template (livereload.js at line 141: this._uri = "ws://" + this.options.host + ":" + this.options.port + "/livereload";) be changed to secure protocals as well in this case?:
this._uri = "wss://" + this.options.host + ":" + this.options.port + "/livereload";

@callumlocke callumlocke referenced this pull request in vohof/gulp-livereload
Closed

HTTPS? #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 29, 2013
  1. @joeybaker

    Enable an https lr server

    joeybaker authored
    By passing the contents of cert files, we can enable an https version of the lr server which is super handy for debugging https.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/server.js
View
13 lib/server.js
@@ -1,9 +1,9 @@
-
var fs = require('fs');
var qs = require('qs');
var path = require('path');
var util = require('util');
var http = require('http');
+var https = require('https');
var events = require('events');
var parse = require('url').parse;
var debug = require('debug')('tinylr:server');
@@ -12,8 +12,6 @@ var constants = require('constants');
var config = require('../package.json');
-module.exports = Server;
-
function Server(options) {
options = this.options = options || {};
events.EventEmitter.call(this);
@@ -32,13 +30,20 @@ function Server(options) {
this.configure(options.app);
}
+module.exports = Server;
+
util.inherits(Server, events.EventEmitter);
Server.prototype.configure = function configure(app) {
debug('Configuring %s', app ? 'connect / express application' : 'HTTP server');
if(!app) {
- this.server = http.createServer(this.handler.bind(this));
+ if (this.options.key && this.options.cert) {
+ this.server = https.createServer(this.options, this.handler.bind(this));
+ }
+ else {
+ this.server = http.createServer(this.handler.bind(this));
+ }
this.server.on('upgrade', this.websocketify.bind(this));
this.server.on('error', this.error.bind(this));
return this;
Something went wrong with that request. Please try again.