commit a fix to have default https port on 443

70 views
Skip to first unread message

tom

unread,
Jan 31, 2012, 7:18:40 AM1/31/12
to no...@googlegroups.com
when run https in default port(443), now.js could not serve file on 443. the fix below maybe helpful.

Index: node_modules/now/lib/fileServer.js
===================================================================
--- node_modules/now/lib/fileServer.js    (revision 889)
+++ node_modules/now/lib/fileServer.js    (working copy)
@@ -75,7 +75,7 @@
         // 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) {


Best regards
  Tom

Eric Zhang

unread,
Feb 1, 2012, 6:44:42 PM2/1/12
to no...@googlegroups.com
Thanks tom, I've merged this change into master.


Eric
--
Co-Founder @ Flotype, makers of NowJS
Reply all
Reply to author
Forward
0 new messages