Skip to content
Browse files

more sensible default port for https

  • Loading branch information...
1 parent 3164a7a commit d7593c3b6ee4aed531a94dac50711b9eb4e4e8e5 @ericz ericz committed Feb 1, 2012
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/fileServer.js
View
4 lib/fileServer.js
@@ -32,7 +32,6 @@ handleResponse = function (request, response) {
// Handle only GET requests for /nowjs/* files. Pass all other requests through
var i;
if (request.method === 'GET') {
-
// Detect if request involves the now.js file
if (request.url.split('?')[0] === '/nowjs/now.js') {
serveFile(__dirname + nowClient, request, response, options);
@@ -75,8 +74,7 @@ serveFile = function (filename, request, response, options) {
// Determine hostname / port if not given in options
var host = request.headers.host.split(':');
var hostServer = options['host'] || host[0];
- var hostPort = options['port'] || host[1] || '80';
-
+ var hostPort = options['port'] || host[1] || ((request.headers.referer.split(':')[0] === 'https') ? '443' : '80');
// Call generate client libs, which takes the desired host/port and executes callback with two parts of now.js as parameters
generateClientLibs(hostServer, hostPort, function (nowText) {

0 comments on commit d7593c3

Please sign in to comment.
Something went wrong with that request. Please try again.